Windows Azure: asp.net <appsetting> for ChatHttpHandler not found - windows

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.)

Related

How do you add a mime type when using ASP.NET vNext?

There's LOADS of information on how to add MIME types into a normal project.
These include configuring IIS, or modifying the web.config.
Both of these options are unavailable to me in vNext with IIS Express.
I had a look at the schema to the project.json file and couldn't find anything in there that would help either.
Can this be done yet? - I want to add a mime type for the .woff2 extension.
If you hosting it on IIS 7 or later then following step will do what you need. This answer I have used Visual Studio 2015 CTP5.
Publish your web application ( ASP.net vnext)
You can publish it to location like C:\MyPublish
Once it get successfully published you will find following location C:\MyPublish\wwwroot. Here You will find web.config.
Now host your site to in IIS ( Make sure that you have used C:\MyPublish\wwwroot as your path)
Now edit web.config over here just like you did for old version to add mime type. ( Following is my edit)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="kpm-package-path" value="..\approot\packages" />
<add key="bootstrapper-version" value="1.0.0-beta2" />
<add key="kre-package-path" value="..\approot\packages" />
<add key="kre-version" value="1.0.0-beta2" />
<add key="kre-clr" value="CLR" />
<add key="kre-app-base" value="..\approot\src\WebApplication5" />
</appSettings>
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
</configuration>
Note: As per my thinking In old version it is fix that it is always windows environment so we have direct web.config file in project and we edit that but now we have to follow different process to register as in future we can host completly on linux env as well.
Update : There is another way to do that as well. If you are using Microsoft.AspNet.StaticFiles package then you will have extension.
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
}
This will indirectly use https://github.com/aspnet/StaticFiles/blob/dev/src/Microsoft.AspNet.StaticFiles/FileExtensionContentTypeProvider.cs. Here you can see all mapping.
Update 2: (Add New Mime Type)
public void Configure(IApplicationBuilder app)
{
StaticFileOptions option = new StaticFileOptions();
FileExtensionContentTypeProvider contentTypeProvider = (FileExtensionContentTypeProvider)option.ContentTypeProvider;
contentTypeProvider.Mappings.Add("<<yourextention>>","<<mimetype>>");
app.UseStaticFiles(option);
}
Until this is released, you can also edit applicationhost.config which I found in D:\Documents\IISExpress\config (yours might be on your C drive [Documents]).
I added:
<mimeMap fileExtension=".woff2" mimeType="font/x-woff2" />
Inside <staticContent>.

How to solve Windows Azure Diagnostic Runtime Error (Could not create WindowsAzure.Diagnostics, Version=xx, Culture=neutral, PublicKeyToken=xx

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

Role Provider error in web.config

My application is in Asp.Net MVC3, my application was running perfectly but all of a sudden i'm getting an error in my Web.Config in my role manager tag.
Below is my RoleManager tag of web.config
<roleManager defaultProvider="MASSIARoleProvider" enabled="true" cacheRolesInCookie="true">
<providers>
<clear />
<add name="MASSIARoleProvider" type="MASSIA.Helpers.MASSIARoleProvider, MASSIA" connectionStringName="MASSIAEntities" />
</providers>
</roleManager>
Below is the error i'm getting directly when i run my application:
[updated Error Image]
I have a file MASSIARoleProvider.cs in my solution in the directory Helper.
Below is Heirarchy of my RoleProvider file.
--> Massia --> Helpers --> MASSIARoleProvider.cs
My solution was executing perfectly but i'm getting this error all of a sudden.
<roleManager defaultProvider="MASSIARoleProvider" enabled="true" cacheRolesInCookie="true">
<providers>
<clear />
<add name="MASSIARoleProvider" type="MASSIA.Helpers.MASSIARoleProvider" connectionStringName="MASSIAEntities" />
</providers>
</roleManager>
Attemp 2:
Check for your MASSIARoleProvider file and see whether the Solution name and references used are perfectly correct.
Attempt 3:
The last and least recommended.
Create a new solution, if and only if your solution is in the beginning stage and try to reconfigure the RoleProvider. Once it solved the issue for me, I made a new solution, added the existing files to the news solution and executed the new solution and it executed perfectly. I did not made any change to the code, i just included the existing files from the old solution to the new one.

Running MiniProfiler with runAllManagedModulesForAllRequests set to false

Recently we upgraded to MiniProfiler version 2.0.1 from v1.7, and since then we have not been able to use it in our MVC3 website because when it tries to get its resources, it instead gets a 404.
An example resource call is:
/mini-profiler-resources/includes.js?v=tNlJPuyuHLy/d5LQjyDuRbWKa0weCpmO3xkO6MH4TtA=
In searching around, most people are suggesting that simply setting runAllManagedModulesForAllRequests should be set to true. For giggles, I went ahead and set it to true, and yes it did work. But that is not an acceptable answer.
How can I keep runAllManagedModulesForAllRequests=false and still use MiniProfiler v2?
I had the same issue - the resources being requested use "static" file extensions (such as .js) and therefore IIS wants to handle them using its static file handler.
Luckily all of the MiniProfiler resources are requested with the path mini-profiler-resources, so you can add the following to your web.config:
<system.webServer>
...
<handlers>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
The entry above instructs IIS that any request for the mini-profiler-resources path to be routed through ASP.NET.
As David Duffet says in the comments in the accepted answer, you might also need to add the following entry to your web config. This worked for me:
<system.web>
<httpHandlers>
<add verb="*" type="System.Web.Routing.UrlRoutingModule" path="mini-profiler-resources/*"/>
</httpHandlers>
</system.web>
I had a similar issue and what I did to fix it was change the application pool to 'integrated' and then I added this new line below to my web.config and it then worked.
Here is what the complete web.config looks like now for mini-profiler.
<system.webServer>
<modules runAllManagedModulesForAllRequests="false" />
<validation validateIntegratedModeConfiguration="false"/> <!-- Here is the new line -->
<handlers>
<add name="MiniProfiler" verb="*" type="System.Web.Routing.UrlRoutingModule" path="mini-profiler-resources/*"/>
</handlers>
</system.webServer>

Configuring Lightspeed for use in MVC3 Web project

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.

Resources