Error executing child request for ChartImg.axd. This is not a duplicate

16,607

Solution 1

Here was my situation:

  • upgraded from 3.5 to 4.0
  • it worked when compiled locally on my machine (64-bit Win7)
  • Did NOT work when published to a Win2003 server

I was simply missing this:

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

Solution 2

I managed to solve the problem (I am using DotNetNuke and I had the error "Error executing child request for ChartImg.axd.")

I added the following lines to my web.config file

<configuration>
  <system.webServer>
    ...
    <handlers>
      ...
      <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>
  <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>

</configuration>

In DotNetNuke, if you want to update the config file from the module during the installation, follow this post.

Solution 3

To anyone else with this problem having not being able to fix it.

  1. I went here: http://forums.asp.net/t/1843074.aspx/1

  2. I copied and pasted this this code into their appropriate sections in the the web.config file.

  3. I then recieved this error message from IIS 8 on running of the page with the chart control:

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

  4. The message also contains suggestions:

Things you can try: Migrate the configuration to the system.webServer/handlers section. You can do so manually or by using AppCmd from the command line. For example, from the IIS Express install directory, run appcmd migrate config "Default Web Site/". Using AppCmd to migrate your application will enable it to work in Integrated mode. It will continue to work in Classic mode and on previous versions of IIS. If you are certain that it is OK to ignore this error, it can be disabled by setting system.webServer/validation@validateIntegratedModeConfiguration to false. Alternatively, switch the application to a Classic mode application pool. For example, from the IIS Express install directory, run appcmd set app "Default Web Site/" /applicationPool:"Clr4ClassicAppPool". Only do this if you are unable to migrate your application.

One of the suggestion were to:

switch the application to a Classic mode application pool. For example, from the IIS Express install directory, run appcmd set app "Default Web Site/" /applicationPool:"Clr4ClassicAppPool". Only do this if you are unable to migrate your application.

So I google it and I went here:

How to switch IIS Developer Express to "Classic Mode"

The best solution to change to classic mode was this:

Using appcmd is not needed, it is best to change this in the project's settings:

Click on the web project in the solution explorer Press F4 to get the properties page to show up (not the properties sheet, but the simpler properties window where you set up general things) Look for 'Managed Pipeline Mode', change this to 'Classic'

Now the Chart control works. If anyone has a better solution (e.g the other solutions suggestions in the error which I do not understand) feel free to answer with a clearer description of those suggetsions.

Solution 4

Use the following attributes in the root asp:chart tag

ImageLocation="~/images/temp/ChartPic_#SEQ(300,3)" ImageStorageMode="UseImageLocation"

remove all configurations in web.config. With the above changes you are going to handle to where to save the chart image not the chart api.

Share:
16,607
user1809104
Author by

user1809104

Updated on June 20, 2022

Comments

  • user1809104
    user1809104 almost 2 years

    I have tried all solutions on this thread: .NET 3.5 chart controls exception: Error executing child request for ChartImg.axd

    I added the

    <add
        path="ChartImg.axd" 
        verb="GET,HEAD" 
        type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
        validate="false" />
    

    code to the httpHandlers section but it still doesn't work.

    I have also added:

    <appSettings>
        <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
    </appSettings>
    
    <httpHandlers>
    ...
        <add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
    ...
    </httpHandlers>
    
    <handlers>
    ...
        <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    
    ...
    </handlers>
    

    But after fighting for a while to place those tags in the correct places in the config file i get the same error.

    Here is my config file currently:

    <?xml version="1.0"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
    
      <appSettings>
        <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
      </appSettings>
      <system.web>
        <httpHandlers>
    
          <add path="ChartImg.axd" verb="GET,HEAD" 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="artem" namespace="Artem.Google.UI" assembly="Artem.Google"/>
          </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>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
      </system.webServer>
    </configuration>
    

    Ive been stuck on this for two hours not able to get anything working. I am using .net framework 4.5