Adding MSCHART to your Windows azure Web Role and WCF service could cause exception
You might hit an exception while sdding MSCHART to your Windows azure Web Role and WCF service could cause exception as below:
- Create a new Windows Azure ASP.NET Webrole
- Add a new WCF Web Role to it
- Build and verify that it does works in Compute Emulator
- Add MsChart control on any ASP page within your Web Role
- Verify that web.config is updated with mschart control specific configuration
- Build and run it again in Compute Emulator
You will hit an exception as below:
To solve this problem you just need to add the following in your web.config inside system.webserver section:
<validation validateIntegratedModeConfiguration="false"/>
The final system.webserver looks like as below:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
Comments
- Anonymous
May 24, 2012
Can you give some background as to why the exception is thrown and the fix is necessary? You don't post issues like this about every control so I assume there is something specific about this control that is a little wonky.