'Web Form charts: No http handler was found for request type 'GET'

I'm getting this error: No http handler was found for request type 'GET'. I figure the reason is with an incorrect web.config, as suggested in the answer to another question. However, following these suggestions doesn't solve my problem completely. Now I'm getting a 500- Internal server error, or 404- Resource *.aspx is not found (this error is indeterminate, 500 at one point and 404 at another). This error only exists after I've deployed to a DEV server. The application runs fine in DEBUG mode. Here's my config file.

<configuration>
 <system.webServer>
   <validation validateIntegratedModeConfiguration="false" />
   <defaultDocument>
     <files>
       <add value="main.aspx" />
     </files>
   </defaultDocument>
   <handlers>
     <add name="ChartImg" verb="*" 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>
   <customErrors mode="Off"/>
   <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.5">
     <assemblies>
       <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       </assemblies>
   </compilation>
   <httpRuntime targetFramework="4.5" />
 </system.web>

 <appSettings>
   <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
   </appSettings>
 <startup>
   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
 </startup>
</configuration>

I also added this tag to my .aspx page:

<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>


Solution 1:[1]

The solution is this

in web.conf add

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

and add

<appSettings>
   <add key="ChartImageHandler" value="storage=file;timeout=20;dir=C:\inetpub\wwwroot\temp\;" />
</appSettings>

change the dir to a folder of your choice

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pedro Paulo Deola