3

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>
user776676
  • 4,265
  • 13
  • 58
  • 77
  • Add this to your web.config file on your webhost under the `system.web` element:``, and then reload the page. That should get you some more detailed error information. – rsbarro Jun 17 '11 at 01:21

3 Answers3

6

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

hapass
  • 322
  • 6
  • 16
  • Welcome to Stack Overflow! You shouldn't just give a link to another site as an answer, since the site may go out of date in the future. Instead, click the "edit" link on this answer and include the essential parts of the solution from that page here. See: http://meta.stackexchange.com/q/8259 – Peter O. Feb 18 '12 at 19:03
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.

Sarah Weinberger
  • 15,041
  • 25
  • 83
  • 130
0

Problem is the temporary directory. It could be because:

  • The directory no exists,
  • The user has no permission to the directory,
  • You are pointing to the wrong directory, or
  • when you move your programs form a local PC to a server you are no longer pointing to a local file, you are pointing to a URL

Solutions:

  • If you are using a web server, the easy and lazy solution is create a directory named temp where the aspx is located. In the same directory and give the users permission to modify.

  • If you are using a local PC you can use memory instead of file. No use this in the web server because is to heave for many users, but use:

    <add key="ChartImageHandler" value="Storage=memory;Timeout=20;"/>
    
  • If you are using a web server, the best option is use a url instead of a file like this:

    <add key="ChartImageHandler" value="storage=file;timeout=20;url=~/temp" />
    

    You can use ~ / . or http://…

To Add permission to the ISS user, could be your user pool, windows user or any user as you used before. If you use Windows authentication, then you should grant permission to the user named “Domain Users”. Some people add permission to the user everybody. This permission should include “Modify”