I use elmah for find error . i want to save error in xml file. after i wrote Commands in cinfig file :
config file :
<elmah>
<security allowRemoteAccess="1"/>
<errorlog type="Elmah.XmlFilerErrorLog, Elmah" logPath="~/App_Data" />
</elmah>
How to access this xml file .is there this file in application ?
you could try
www.yourdomain.com/elmah.axd
Related
privateLibManager libManager;
private LibManager Connect()
{
this.libManager=new LibManager();//here we are getting an error
}
Error:
The type initializer for 'SWConfigDataClientLib.LibManager' threw an exception
Inner Exception:
Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics,Version=2.2.0.0,Culture=neutral,
PublicKeyToken=31bf3856ad364e35.
Source
IpPbxCDSClientLib
First make sure you have added references to Microsoft.WindowsAzure.Diagnostics from the SDK folders (typically c:\Program Files\Microsoft SDKs\Windows Azure.NET SDK\v2.2\ref\Microsoft.WindowsAzure.Diagnostics.dll)
Next, if you are not running your project in the emulator (i.e. the cloud project set as the startup project), then set the trace filter level to TraceEventType.Error or TraceEventType.None to avoid trying to write verbose Azure messages to the trace listener. In you web or app config:
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter level="TraceEventType.Error" />
</add>
</listeners>
</trace>
</system.diagnostics>
I had the same error.
I was missing a reference to Microsoft.WindowsAzure.Diagnostics
Ok So even I had this exception being thrown continuously. However, my case was a little different.
I wanted to get rid of this reference as it was no longer required in the project. So I removed it from the references. But while running the application, I started getting this exception at a Debug.WriteLine(...); statement which suggested that the reference was required.
On further analysis, I found that the below section was present in the project's app.config file which was the cause of the exception.
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
After removing the reference AND also removing the above section from config file, the issue got fixed.
Hope this helps!
Make sure you have added this reference to your project
Microsoft.Azure.Plugins.Diagnostics.dll
I have a VSTO Excel 2007 add-in that should read connectionstrings from the app.config file, and then let the user decide which database to connect to. This works fine when I debug it, but when I run the deployed version (done with Windows Installer) the connectionstrings aren't read at all. I have added the primary outputs from all the projects to the setup project.
The app.config file is in the ExcelAddIn project, but not under the Excel heading. The class that manages the connectionstrings is in another project.
Here is my app.config file:
<?xml version="1.0"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<connectionStrings>
<clear/>
<add name="MyEntities" connectionString="metadata=res://*/MyModel.csdl|res://*/MyModel.ssdl|res://*/SymModel.msl;provider=System.Data.SqlClient;provider connection string="data source=myServer;initial catalog=myDB;persist security info=True;user id=myUser;password=myPassword;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0"/>
</parameters>
</defaultConnectionFactory>
</entityFramework>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
I use the following to get to the connectionstrings:
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConnectionStringsSection csSection = config.ConnectionStrings;
I have tried to add the ExcelAddin.dll.config file to the setup project's folder in which the Release folder and .proj file are. I have set the app.config file's 'Copy to Output Directory' property to 'Copy always' and the Build Action property to 'Content'.
Is there something worng with my app.config file, or why is it not picked up (the connectionstrings are not loaded into csSection) after I've run the installer?
Add file:/// to [TARGETDIR]ExcelAddIn.vsto|vstolocal (ex: file:///[TARGETDIR]ExcelAddIn.vsto|vstolocal) at the registry entries under "installer".
You need to add app.Config File to your Setup Project but not from the actual project do it from the Release\Debug folder of the ExcelAddIn project.
When you build you ExcelAddIn project it will leave App.config File to the Release\Debug Folder, piCk the file form there and include it into the dependicies folder of the Setup Project.
It seems that it is working with ClickOnce. So I still don't know what the problem was with the setup project and using Windows Installer, but at least I can deploy it.
I have a question regarding using LightSpeed in a MVC3 Web application. I am creating a REST Api project where I want to use LightSpeed, but the official configuration guidelines are quite vague. The official documentation says that the following lines need to be added to the file web.config:
<configSections>
<section name="lightSpeedContexts"
type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed" />
</configSections>
<lightSpeedContexts>
<add name="Test" />
</lightSpeedContexts>
<lightSpeedContexts>
<add name="Test" dataProvider="SQLite3" />
</lightSpeedContexts>
I tried adding following lines to the web.config in the root:
<configSections>
<section name="lightSpeedContexts"
type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed" />
</configSections>
<lightSpeedContexts>
<add name="Default" connectionStringName="Prod" dataProvider="MySQL5" />
</lightSpeedContexts>
<connectionStrings>
<add name="Prod" connectionString="server=localhost;User Id=production;password=xxx;Persist Security Info=True;database=CBS"/>
</connectionStrings>
This throws an exception when I start the Web application which tells me that configSections may not be specified more than once in the application. The root web.config file did not have any of these specified per default.
I am not sure where to put this configuration.
OK, I found out how to solve the problem.
I moved out the configSections that were in the two sub web.config files (in each Views folder) and put the contents in the main web.config file, then I added the lightSpeedContexts and connectionStrings in the main web.config file.
I'm trying to pull off an inheritance chain of appSetting sections (VS2010 C#)
Given this,
Base.config
<appSettings>
<add key="basekey" value="basevalue"/>
</appSettings>
Derived.config
<appSettings file="Base.config">
<add key="derivedkey" value="derivedvalue" />
</appSettings>
App.config
<configuration>
<appSettings file="Derived.config">
<add key="mykey" value="myvalue" />
</appSettings>
</configuration>
This line:
ConfigurationManager.AppSettings["derivedkey"]
Throws exception:
Unrecognized attribute 'file'. Note that attribute names are case-sensitive. (...\Derived.config line 1)
It appears that App.config can successfully "file" over to Derived.config, but Derived.config is unable to "file" over to Base.config because "file" suddenly becomes an unknown attribute.
It's a little circular/confusing to me since the "file" attribute in App.config must be recognized successfully in order to reach Derived.config, where the same "file" attribute is suddenly unknown.
This is just not alllowed. You can not specify another external AppSetting file from within the first external AppSetting file.
I have a problem in setting the chartHttpHandler in web.config for windows azure
Initially I added a chartHttpHandler on my web.config file
<remove name="ChartImageHandler"/>
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
under system.webServer section
Then I got an error stating
Invalid temp directory in chart handler configuration [c:\TempImageFiles\].
Then I found that I should change in
From
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
To
<add key="ChartImageHandler" value="storage=file;timeout=20;" />
I am not able to find this section in my web.config file. So I tried to add it under section but it gave me error that it is an invalid child
Likewise, I tried adding it under section, it too gave the same error...
So, I added sepeartely, Then I am not able to see anything.. The webpage is just blank...
What should I have to do.. Can anyone tell me "how to solve it"
Looks like you need to add it in appSettings... http://blogs.msdn.com/deliant/archive/2008/12/02/managing-chart-generated-images-with-chart-image-handler.aspx
(No personal knowledge about this, but that's the first link I found via Bing.)