Chart Control Asp.net 4.0 and IIS 7 Problem

I’ve decided to add the new ASP.NET 4.0 Chart Control to one of my web apps. Everything worked fine during the testing on my local machine, but once I published it to remote IIS 7.0 server I’ve got the following error:

HTTP Error 500.23 – Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

So the simple solution that worked for me was just to remove the following entry from web.config <system.web> section:

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

Also make sure that <system.webServer> section has the following:

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

Hello Friends..

Victor Suggest me some cool stuff change just add below highlight line and it work in both IIS and debug mode…. Nice and rocking…..

<system.webServer>
   <validation validateIntegratedModeConfiguration=”false”/>
    <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>
</system.web>

 

About these ads

About Asif
Hello Friends… I have done my Bachelor of Engineering in Information Technology from Gujarat University. I have 1.7 years experience of web and windows based application development.. My basic idea to start a blog is to store all important link which help me in my application and access to every where. Also this information is help others who want to makes their application powerful. I am interested in .net framework (1.0,2.0,3.0,3.5 and more). This blog contain also many information related to SQL, Custom Controls in C#.net Please share your ideas and any query if you have...

17 Responses to Chart Control Asp.net 4.0 and IIS 7 Problem

  1. Victor says:

    Thank you dude, it works!

  2. Wagner Silva says:

    Cool, it worked!
    But I had to create the c:/TempImageFiles/ dir to work.

    How do I use another dir?

  3. den says:

    I have the same problem, and I removed it, and after it wroked. BUT after closing VS and opening it again, web.config contains this line again. What am I supposed to do?

  4. Victor says:

    thanks for the solution. however, it works on IIS but it doesn’t work on debug mode anymore. any idea for that?

    • Asif says:

      yes once you remove ChartImg.axd tag from httpHandlers it wont work on IIS. just delete chart from page and from designer replace on page will resovle issue on debug.

      When you finally deploy on IIS then do as explain above.
      Thanks.

      • Victor says:

        Thanks for your reply. However, I found a solution to make it work on both IIS and debug mode.

        Cheers,
        Victor

      • Victor says:

        You do not have all remove anything, simply add this after

        and it will work on both IIS and debug mode. Hope this helps :)

  5. Victor says:

    I don’t know why my code is not showing in the comments.

  6. Jimbo says:

    Thank you so much. This works for me.

  7. mahmoud younes says:

    v v v thanks man

  8. santosh says:

    Thanks victor

  9. Khushal says:

    Thanx ..!!!…Worked For me…..

  10. Gertrude says:

    Good post! We are linking to this great article on our
    site. Keep up the great writing.

  11. Puneet says:

    hi i am trying to display my bar chart control in a web part , when i am creating a simple .net application it is working fine .when i am wrapping that user control in a webpart it is not gtg displaying in webpart.
    below is my code

    —————————————–
    i tried making changes in webconfig files nothing is working for me
    and one doubt where i need to create that folder C:/TempImageFiles

  12. bozo says:

    thanks! it worked for me just removing the “dir=c:\TempImageFiles\;” from web.config as refered on the page: http://stackoverflow.com/questions/6380100/asp-net-chart-whats-wrong-with-my-web-config-i-cant-display-a-chart that also points to this page ;)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: