ASP.NET Chart: What's wrong with my web.config. I can't display a chart

13,953

Solution 1

try this link http://asifhuddani.wordpress.com/2010/10/07/chart-control-asp-net-4-0-and-iis-7-problem/

and then delete dir=c:\TempImageFiles\; from web.config

Solution 2

I had the same problem, namely a 500 server error adding in the same section. Two changes resolved the 500 serve error.

  1. replaced "add path="ChartImg.axd" verb="GET,HEAD with add path="ChartImg.axd" verb="GET,HEAD,POST".

  2. Added line after system.webServer tag:

    [validation validateIntegratedModeConfiguration="false"/]

I had to replace < with [, otherwise the preview did not show the tag.

Share:
13,953
user776676
Author by

user776676

Beginner.

Updated on June 05, 2022

Comments

  • user776676
    user776676 almost 2 years

    I just created a web page having a barebone chart with a few data points to test. On localhost, the chart is displayed as expected with no problem. But when I deployed to my webhost I got a 500 - Internal Server Error

    500 - Internal server error.
    There is a problem with the resource you are looking for, and it cannot be displayed.
    

    Here's the web.config uploaded by Visual Studio. Could you tell me what's missing or wrong in this web.config. The appSettings look suspicious with a dir in C:, but how do I change it? Thanks.

    <?xml version="1.0"?>
    <configuration>
    <appSettings>
    <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
    </appSettings>
    <system.webServer>
    <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>
     </system.webServer>
     <system.web>
     <httpHandlers>
      <add path="ChartImg.axd" verb="GET,HEAD,POST"   type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        validate="false" />
    </httpHandlers>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
          assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </controls>
    </pages>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
     </system.web>
    </configuration>