Formular una preguntaFormular una pregunta
 

RespondidaError executing child request for ChartImg.axd

  • miércoles, 29 de octubre de 2008 17:29MDMoore Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    I am trying to get started with the ASP.net chart controls and I keep getting the error message "Error executing child request for ChartImg.axd"

    I've dumbed it down to a cut and paste sample from the samples site. I checked and made sure that the DLL is installed, referenced, etc. 
    Also made sure that the user that VS/WebDev.WebServer runs as (me) has rights to the TempImages folder.

    Anyone had any luck with this and have any suggestions?

    Thanks!





    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ChartTest._Default" %> 
     
    <%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
        Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
        <div> 
         
        <asp:ScriptManager runat="server" ID="ScriptManger1" /> 
         
            <asp:chart id="Chart1" runat="server" Height="296px" Width="412px" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" Palette="BrightPastel" imagetype="Png" BorderDashStyle="Solid" BackSecondaryColor="White" BackGradientStyle="TopBottom" BorderWidth="2" backcolor="#D3DFF0" BorderColor="26, 59, 105"
                            <legends> 
                                <asp:Legend IsTextAutoFit="False" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold"></asp:Legend> 
                            </legends> 
                            <borderskin skinstyle="Emboss"></borderskin> 
                            <series> 
                                <asp:Series Name="Column" BorderColor="180, 26, 59, 105"
                                    <points> 
                                        <asp:DataPoint YValues="45" /> 
                                        <asp:DataPoint YValues="34" /> 
                                        <asp:DataPoint YValues="67" /> 
                                        <asp:DataPoint YValues="31" /> 
                                        <asp:DataPoint YValues="27" /> 
                                        <asp:DataPoint YValues="87" /> 
                                        <asp:DataPoint YValues="45" /> 
                                        <asp:DataPoint YValues="32" /> 
                                    </points> 
                                </asp:Series> 
                            </series> 
                            <chartareas> 
                                <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" BackColor="64, 165, 191, 228" ShadowColor="Transparent" BackGradientStyle="TopBottom"
                                    <area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle> 
                                    <axisy linecolor="64, 64, 64, 64"
                                        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" /> 
                                        <majorgrid linecolor="64, 64, 64, 64" /> 
                                    </axisy> 
                                    <axisx linecolor="64, 64, 64, 64"
                                        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" /> 
                                        <majorgrid linecolor="64, 64, 64, 64" /> 
                                    </axisx> 
                                </asp:ChartArea> 
                            </chartareas> 
                        </asp:chart> 
        </div> 
        </form> 
    </body> 
    </html> 
     
     


    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.DataVisualization.Charting; 
     
    namespace ChartTest 
        public partial class _Default : System.Web.UI.Page 
        { 
            protected void Page_Load(object sender, EventArgs e) 
            { 
                // Create new data series and set it's visual attributes 
                Series series = new Series("Spline"); 
                series.ChartType = SeriesChartType.Spline; 
                series.BorderWidth = 3
                series.ShadowOffset = 2
     
                // Populate new series with data 
                series.Points.AddY(67); 
                series.Points.AddY(57); 
                series.Points.AddY(83); 
                series.Points.AddY(23); 
                series.Points.AddY(70); 
                series.Points.AddY(60); 
                series.Points.AddY(90); 
                series.Points.AddY(20); 
     
                // Add series into the chart's series collection 
                Chart1.Series.Add(series); 
     
     
            } 
        } 
     
     

    •  

Respuestas

  • lunes, 12 de enero de 2009 10:39P.Looijmans Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Respondida
    I encountered the "Error executing child request" error on my page as well and followed all the instructions in this thread but no luck. So I used Reflector to see what was going on, found the Server.Execute mentioned earlier in this thread and then debugged into the .NET source code to see what was going wrong and I think I've found the cause of my error.

    As mentioned everywhere you have to add the following handler to the configuration of your web app:

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

    In my case the chart is on the second tab of a Telerik RadMultiPage which uses postbacks. When I open the second tab the chart is loaded and the Server.Execute to ChartImg.axd is called. When you use Server.Execute, the http verb used for the parent request is also used for the child request. Since I'm doing a postback the verb will be POST which -as you can see in the "verb" attribute in the configuration setting above- is not allowed so it throws an error. So the simple change you have to make to get the chart to work is to add "POST" to the allowed verbs:

     <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

    This would also explain why the chart control won't work on anything but the first page of an asp:wizard control or any other page where the EnsureInitialized check is done in a postback.

    I've seen this error message on many forums without a satisfactory fix being offered, so I'm guessing it's pretty common. As far as I can tell, the Server.Execute call to ChartImg.axd is only done to ensure the handler is configured correctly. It's kind of ironic that this check is the cause of so many errors. I think it's a case of code trying to be too smart for it's own good.
  • viernes, 05 de diciembre de 2008 19:01DelianTMSFT, ModeradorMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Respondida
    DrNelsona:

    If you want to use Chart.ImageLocation you also have to set 

    Chart1.ImageStorageMode = System.Web.UI.DataVisualization.Charting.
    ImageStorageMode.UseImageLocation;
    This will bypass chart image handler but you will lose privacy,multi-worker process and web farms handling.

    Take a look at this post how to run the chart under ASP.Net MVC:
    http://code-inside.de/blog-in/2008/11/27/howto-use-the-new-aspnet-chart-controls-with-aspnet-mvc/

Todas las respuestas

  • miércoles, 29 de octubre de 2008 20:08Alex GorevMSFT, PropietarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    It looks like there is an issue in chart HTTP handler configuration. You can try use image location instead, by setting Chart.ImageStorageMode="UseImageLocation".

    If you want to verify your HTTP handler, open your web.config file and make sure you have all chart related settings in there. All these settings should be automatically added when you add a chart from the toolbox into your web page.

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



    Alex.

     

  • miércoles, 29 de octubre de 2008 21:09MDMoore Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Those settings were missing from the web config (I used the toolbox the first time I tried in my real project, but in my test project I copy/pasted the code from the sample.)

    I verified that both changing ImageStorageMode or adding the specified items to Web.config resolve the issue.

    Thanks! :)

    Hopefully this gets indexed and people searching for that error can find it; MSChart is so new that I couldn't find any reference to that error :)
  • martes, 04 de noviembre de 2008 14:46KaiserWilhelm Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    I was also having this problem!  I added those values to the web.config and bam!... problem gone!
  • martes, 18 de noviembre de 2008 7:25andersco Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Hmm...these settings were already in my web.config and recopying them from here didn't fix the problem.  Setting the ImageStorageMode="UseImageLocation" works but I cannot get the HTTP handler to work.  Any other ideas?
  • martes, 18 de noviembre de 2008 8:48Alex GorevMSFT, PropietarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    What kind of error message you getting?
  • martes, 18 de noviembre de 2008 16:43Nick20891 Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Hey Alex,

    First of all thanks for the fix. I pulled the chart from my toolbox and it still didn't automatically populate the web.config file. I'll continue to look into that. I did have another question. Is there anyway you can show me an example of the application settings and httphander settings you would use for making the chart use session variables to store the image? I am limited in that I can't do any file i/o on the servers.

    Just making sure I'm not missing anything as I'm having a hard time tracking images being created at all in the c:\TempImageFiles\.

    Any help would be appreciated,
    Nick


  • martes, 18 de noviembre de 2008 17:05andersco Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Alex-

    I am getting the same error as the original poster described:

    "Error executing child request for ChartImg.axd"

    Thanks for any other suggestions.
  • martes, 18 de noviembre de 2008 18:03Alex GorevMSFT, PropietarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Settings in the webconfig usually the source of any HTTP Handler issues. Have you installed the samples and do they work fine? If samples run fine, what is the difference between your weconfig and the one in the samples. Also try creating a brand new ASP.NET application drop a chart in there and see if it works.

    Alex.
  • martes, 18 de noviembre de 2008 23:52andersco Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    This is strange...the samples work, and also if I create a new project and add a chart it works.  It is only in my project that it doesn't work.  I tried copying all of the sections from the sample project's web.config into mine but it still doesn't work.  Could there be something conflicting in my web.config?  Here it is:

    <?xml version="1.0"?><configuration> 
          
      <configSections> 
            <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">  
                <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">  
                    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>  
                    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">  
                        <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>  
                        <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>  
                        <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>  
                        <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>  
            </sectionGroup> 
          </sectionGroup> 
        </sectionGroup> 
      </configSections> 
     
      <appSettings> 
        <add key="ChartImageHandler" value="Storage=file;Timeout=20;Url=~/tempImages/;"/>  
      </appSettings> 
          
      <connectionStrings> 
            <add name="websiteConnectionString" connectionString="" providerName="System.Data.SqlClient"/>  
            <add name="appservicesdbConnectionString" connectionString="" providerName="System.Data.SqlClient"/>  
        </connectionStrings> 
          
      <system.web> 
            <sessionState cookieless="AutoDetect">  
            </sessionState> 
              
        <compilation debug="true">  
                <assemblies> 
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>  
            <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>  
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
            <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>  
            <add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
            <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>  
          </assemblies> 
        </compilation> 
              
        <authentication mode="Forms">  
                <forms loginUrl="~\MembershipFiles\LoginPage.aspx" cookieless="AutoDetect"/>  
            </authentication>         
     
        <customErrors mode="Off"/>  
              
        <pages theme="defaultTheme">  
          <controls> 
            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
            <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
            <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>  
          </controls> 
        </pages> 
              
        <membership defaultProvider="CustomizedProvider">  
                <providers> 
                    <clear/> 
                    <add name="CustomizedProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="appservicesdbConnectionString" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" requiresUniqueEmail="true" applicationName="/"/>  
                </providers> 
            </membership> 
          
            <roleManager enabled="true" defaultProvider="CustomizedRoleProvider">  
                <providers> 
                    <clear/> 
                    <add name="CustomizedRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="appservicesdbConnectionString" applicationName="/"/>  
                </providers> 
            </roleManager> 
              
        <healthMonitoring enabled="true">  
                <providers> 
                    <clear/> 
                    <add name="SqlWebEventProvider" connectionStringName="appservicesdbConnectionString" maxEventDetailsLength="1073741823" buffer="false" bufferMode="Notification" type="System.Web.Management.SqlWebEventProvider"/>  
                </providers> 
                <rules> 
                    <clear/> 
                    <add name="Failure Audits Events Rule" eventName="Failure Audits" provider="SqlWebEventProvider" profile="Critical"/>  
                </rules> 
            </healthMonitoring> 
              
        <trace enabled="true" mostRecent="true"/>  
              
        <deviceFilters> 
                <filter name="IsIEBrowser" compare="Browser" argument="IE"/>  
            </deviceFilters> 
     
        <httpHandlers> 
          <remove verb="*" path="*.asmx"/>  
          <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
          <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
          <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>  
          <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> 
              
        <httpModules> 
                <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
        </httpModules> 
      </system.web> 
        
      <system.net> 
            <mailSettings> 
                <smtp from="">  
                    <network host="PLCNU8300MLT" password="" userName=""/>  
                </smtp> 
            </mailSettings> 
        </system.net> 
     
      <location path="Admin">  
        <system.web> 
          <authorization> 
            <deny users="?"/>  
          </authorization> 
        </system.web> 
      </location> 
     
      <location path="User">  
        <system.web> 
          <authorization> 
            <deny users="?"/>  
          </authorization> 
        </system.web> 
      </location> 
        
        <system.codedom> 
            <compilers> 
                <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/warnaserror-">  
                    <providerOption name="CompilerVersion" value="v3.5"/>  
          </compiler> 
                <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" compilerOptions="/optioninfer+">  
                    <providerOption name="CompilerVersion" value="v3.5"/>  
          </compiler> 
        </compilers> 
      </system.codedom> 
          
     
      <!--  
            The system.webServer section is required for running ASP.NET AJAX under Internet  
            Information Services 7.0. It is not necessary for previous version of IIS.  
        --> 
        <system.webServer> 
         <validation validateIntegratedModeConfiguration="false" /> 
        <modules> 
          <remove name="ScriptModule"/>  
          <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
        </modules> 
        <handlers> 
          <remove name="WebServiceHandlerFactory-Integrated"/>  
          <remove name="ScriptHandlerFactory"/>  
          <remove name="ScriptHandlerFactoryAppServices"/>  
          <remove name="ScriptResource"/>  
          <remove name="ChartImageHandler"/>  
          <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
          <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
          <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
          <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> 
     </system.webServer> 
     
    </configuration> 

    Thanks for your help
  • jueves, 20 de noviembre de 2008 7:44grsmith Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código

    Just an observation, not necessarly an answer. 

    I had the previously-described symptom ("Error executing child request for ChartImg.axd") - until I realized I had targeted the 2.0 Framework in my build options.  As soon as I switched to 3.5 all was well. 

    This does not seem to explain MDMoore resolving this issue by adding the code Alex provides.  However, it has been observed that Framework 2.0 will actually run the Chart Controls (http://forums.microsoft.com/MSDN/ShowPost.aspx?Post&Site)

    As for the code not being automatically added to web.config:
    I had that symptom also.  But, upon switching the target Framework, VS found the Chart control and the missing code was "retroactively" added to web.config.  Nice.

    For readers who haven't done this:
    Right-click your project, select Start Options, select Build, etc.

    ...Late entry...
    Regarding the ChartImageHandler key in appSettings:
    The auto-generated code in my project set this as follows:

    <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" /> 

    This was fine with the ASP.NET Development Server, but not when I published the project to IIS (even IIS on the local machine).  Running the published project produced:

    Invalid temp directory in chart handler configuration [c:\TempImageFiles\].

    Using Process Monitor (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) I could see aspnet_wp.exe looking for this png file first in the root of my published webfolder.  Then, not finding it there it looked for the folder c:\TempImageFiles\ - which never did exist on this PC.

    Completly removing the dir attribute of the ChartImageHandler value solved the problem.  But, perhaps not in the best way.  Perhaps someone else will explain further.

    NOTE: ChartImg.axd is queried for in your published webfolder also.
  • viernes, 21 de noviembre de 2008 7:03andersco Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Well I still don't know why I was getting the exception but I seem to have found a workaround.  I did an experiment where I took the supposed offending web.config and copied it to a new project where I added a new web form and chart control and the chart control rendered fine with the "UseHttpHandler" option.  This led me to believe that it wasn't actually the web.config that was the problem in my case, so I went back to the original project and added a chart to another web form as an experiment, and it worked!  Even more surprising was that after that I went to the offending page and it worked too!  Then I took the new chart off the other page and checked the original offending page and it was broken again.  Then I found out if I put a chart control on any page before the offending page, it would work, otherwise it threw the exception.  These controls are so cool though that I didn't have a problem finding another page to put one on in the path of the offending page :)

    This fixed the problem but if anyone has any theory why I'd be interested...maybe a bug?
  • miércoles, 26 de noviembre de 2008 13:05Justin Wignall Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    I can confirm andersco's findings, the workaround I made (When using the ChartImageHandler) was to add the line

    <asp:chart id="Chart2" runat="server" Height="1px" Width="1px"></asp:chart> 


    to the bottom of the page leaving all other settings as they are.

    My page contains one other chart control "Chart1" that uses UseHttpHandler ImageStoreageMode - visiting any page within the project with a chart control on it before viewing this page means everything works fine, viewing the page with the UseHttpHandler chart image first causes the ChartImg.axd error.
  • jueves, 27 de noviembre de 2008 6:07smallolo Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     

    my english is poor

    my soluction:

        <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />

    To
        <add key="ChartImageHandler" value="storage=file;timeout=20;" />

    OK

  • lunes, 01 de diciembre de 2008 16:25Tag srl Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    Hello to everybody,
    I'm also get stucked on ChartImageHandler's problem.... I debugged a bit using reflector and MS Symbols and I found that the EnsureInitialized method executes :

    private static void EnsureInitialized(bool hardCheck)
    {
    if (!_installChecked)
    {
    if (HttpContext.Current != null)
    {
    try
    {
    HttpContext.Current.Server.Execute("ChartImg.axd");
    _installed = true;
    }
    catch (HttpException)
    {
    if (hardCheck)
    {
    throw;
    }
    }
    catch (SecurityException)
    {
    _installed = !string.IsNullOrEmpty(WebConfigurationManager.AppSettings["ChartImageHandler"]);
    }
    }
    _installChecked = true;
    }
    if ((_installed || hardCheck) && (_parameters == null))
    {
    _parameters = InitializeParameters();
    InitializeControllerFile();
    }
    }

    I get this inside the StaticFileHandler.cs :

    private static FileInfo GetFileInfo(string virtualPathWithPathInfo, string physicalPath, HttpResponse response) {
    // Check whether the file exists
    if (!FileUtil.FileExists(physicalPath)) {
    throw new HttpException(HttpStatus.NotFound,
    SR.GetString(SR.File_does_not_exist));
    }
    // To prevent the trailing dot problem, error out all file names with trailing dot.
    if (physicalPath[physicalPath.Length-1] == '.') {
    throw new HttpException(HttpStatus.NotFound,
    SR.GetString(SR.File_does_not_exist));
    }
    }

    and it's related to the file "ChartImg.axd", is it possible that for some reason the axd file is not been created?
    It's looking for it into website bin directory..is it ok?
    Thanks



  • lunes, 01 de diciembre de 2008 21:35Matt M19543 Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    I've been getting this error as well and I found that it happens when I have a chart control set to display:none and later displays itself after a postback.  When I changed it to a visibility:hidden so that it's still rendering just not displaying it worked fine.  Luckily our current site design allowed this kind of change.  It looks like there's something that the chart control doesn't like about only being displayed after postbacks.
  • viernes, 05 de diciembre de 2008 9:07DrNelsona Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    I am also getting this error, when trying to use the charts within an ASP.Net MVC application.

    I have tried all of the suggestions so far but still no joy. The code I am running is as follows:
            Chart PRReport = new Chart(); 
            PRReport.Width = 412
            PRReport.Height = 296
            PRReport.RenderType = RenderType.ImageTag; 
            PRReport.ImageLocation = "..\\..\\TempImages\\ChartPic_#SEQ(200,30)"
     
            PRReport.Palette = ChartColorPalette.BrightPastel; 
            Title t = new Title("Problem Records Report", Docking.Top, new System.Drawing.Font("Trebuchet MS", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); 
            PRReport.Titles.Add(t); 
            PRReport.ChartAreas.Add("Series 1"); 
     
            // create a couple of series 
            PRReport.Series.Add("Series 1"); 
     
            CustomLabel myLabel; 
            int i = 1
     
            // add points to series 1 
            foreach (Report pr in (IEnumerable)ViewData["PRReport"]) 
            { 
                if (pr.Count > 0) 
                { 
                    myLabel = PRReport.ChartAreas["Series 1"].AxisX.CustomLabels.Add((Convert.ToDouble(i) - 0.5), (Convert.ToDouble(i) + 0.5), pr.Name); 
                    PRReport.Series["Series 1"].Points.AddY(pr.Count); 
                    i++; 
                } 
            } 
     
            PRReport.BorderSkin.SkinStyle = BorderSkinStyle.Emboss; 
            PRReport.BorderColor = System.Drawing.Color.FromArgb(26, 59, 105); 
            PRReport.BorderlineDashStyle = ChartDashStyle.Solid; 
            PRReport.BorderWidth = 2
     
            // Render chart control 
            PRReport.Page = this
            HtmlTextWriter writer = new HtmlTextWriter(Page.Response.Output); 
            PRReport.RenderControl(writer); 
     

    The web.config contains all the pieces mentioned so far in this discussion...


  • viernes, 05 de diciembre de 2008 17:55Victor Arakcheev - MSFTMSFTMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    If you have problems with chart handler, try changing the "starage" from "file" to "memory" or "session".

    <add key=“ChartImageHandler” value=“storage=memory;timeout=20;”/>

    or:

    <add key=“ChartImageHandler” value=“storage=session;timeout=20;”/> 

  • viernes, 05 de diciembre de 2008 19:01DelianTMSFT, ModeradorMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Respondida
    DrNelsona:

    If you want to use Chart.ImageLocation you also have to set 

    Chart1.ImageStorageMode = System.Web.UI.DataVisualization.Charting.
    ImageStorageMode.UseImageLocation;
    This will bypass chart image handler but you will lose privacy,multi-worker process and web farms handling.

    Take a look at this post how to run the chart under ASP.Net MVC:
    http://code-inside.de/blog-in/2008/11/27/howto-use-the-new-aspnet-chart-controls-with-aspnet-mvc/
  • lunes, 08 de diciembre de 2008 16:51Raymond Mimick Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    I was getting this same error on my development and our QA 64-bit environments.  When setting the ImageStorageMode= property, it output the .png file but did not listen to the URL=~/TempImageFiles/ and put it in the root of the directory.  I experimented with the storage=memory but that didn't do anything.  I ended up thinking about just removing the setting and lo, it creates the image in memory of the machine. 

    Once I deployed to my QA environment, everything seems to be much happier without that property. 

    New problem: I'm using Windows Load Balancing for this site and it appears that the image will render on that one machine; Looking into what ever caching is needed.
  • miércoles, 10 de diciembre de 2008 10:11Tag srl Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Tiene código
    hello, anyone else is experiencing this error on vista/windows 2008 64bit edition?
    I've tried all the possible solution explained in this thread (and in other similar) but the only way I got it working is using "UseImageLocation"...
    I've found (enabling native code debugging) that it hangs here (inside httpserverutility.cs):

       public void Execute(string path) {
                Execute(path, null, true /*preserveForm*/);
            }

    with path set as "ChartImg.axd", is it rigth??

    Thanks in advance
    Paolo

  • jueves, 11 de diciembre de 2008 13:49Tag srl Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Hello,
    I've discovered what causes the iussue..... We've got a logged content page under the path ~/ControlPanel/Statistics.ascx, we load this usercontrol from an asp:Menu and the ascx is loaded inside a ContentPlaceHolder.
    Here's the code of the aspx :

    Code

    If I load before a page that load a chart and it's "simplier" then this one I'm able to load also this ascxwithout any problem, otherwise I get this error "Error executing child request for ChartImg.axd" . If I reset the application pool I've to redo the trick...
    Is it possible that it's due to partial page rendering?
    Thanks in advance
    Paolo

  • martes, 16 de diciembre de 2008 11:51StuartLodge Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    I don't know if this is the same problem as everyone else has seen (sounds like maybe it's different).

    I wrote a page with a chart in it.

    I then changed the page to use an asp:Wizard - the chart being in the last step.

    After this change, I got the executing error shown below when I reached the last page.

    Moving the chart out of the wizard and back into the root of my control removed the error.

    However, when I moved the chart back to the last step of the wizard again, the error was cleared....

    Somewhat confused at present...


    Error executing child request for ChartImg.axd.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Error executing child request for ChartImg.axd.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): Error executing child request for ChartImg.axd.]
    System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2675871
    System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) +819
    System.Web.HttpServerUtility.Execute(String path) +8
    System.Web.UI.DataVisualization.Charting.ChartHttpHandler.EnsureInitialized(Boolean hardCheck) +152
    System.Web.UI.DataVisualization.Charting.ChartHttpHandler.EnsureInstalled() +27
    System.Web.UI.DataVisualization.Charting.Chart.GetImageStorageMode() +46
    System.Web.UI.DataVisualization.Charting.Chart.Render(HtmlTextWriter writer) +201
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27


    Stuart
  • martes, 16 de diciembre de 2008 12:05StuartLodge Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Just as a follow up to that last post

    Have it reproducible.

    - If I restart the webserver each time (I'm using the dev web server at present) with the chart inside the wizard then I get the error - until I move the chart outside the wizard.

    - If I restart the webserver with the chart outside the wizard then it works, then when I move the chart inside the wizard again, then it still works.

    (Not sure it's relevant, but in this current app my page contains a user control in which I've placed the wizard inside the last step of which I've placed another custom control inside which I've placed the chart)

    Stuart - geekie blog at http://slodge.blogspot.com
  • lunes, 12 de enero de 2009 10:39P.Looijmans Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     Respondida
    I encountered the "Error executing child request" error on my page as well and followed all the instructions in this thread but no luck. So I used Reflector to see what was going on, found the Server.Execute mentioned earlier in this thread and then debugged into the .NET source code to see what was going wrong and I think I've found the cause of my error.

    As mentioned everywhere you have to add the following handler to the configuration of your web app:

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

    In my case the chart is on the second tab of a Telerik RadMultiPage which uses postbacks. When I open the second tab the chart is loaded and the Server.Execute to ChartImg.axd is called. When you use Server.Execute, the http verb used for the parent request is also used for the child request. Since I'm doing a postback the verb will be POST which -as you can see in the "verb" attribute in the configuration setting above- is not allowed so it throws an error. So the simple change you have to make to get the chart to work is to add "POST" to the allowed verbs:

     <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

    This would also explain why the chart control won't work on anything but the first page of an asp:wizard control or any other page where the EnsureInitialized check is done in a postback.

    I've seen this error message on many forums without a satisfactory fix being offered, so I'm guessing it's pretty common. As far as I can tell, the Server.Execute call to ChartImg.axd is only done to ensure the handler is configured correctly. It's kind of ironic that this check is the cause of so many errors. I think it's a case of code trying to be too smart for it's own good.
  • jueves, 12 de febrero de 2009 17:22insane.k Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     

    charts were working fine, until I added a series in the design time that wouldn't render.
    I tried to undo my changes, to no avail.

    For some reason my tempImages dir had been set to read-only (nb a square tick - so guessing sub files),
    unchecking this solved the problem for me.

    I am running vs2008 sp1 on 64 bit vista, if it helps. With the same web.config relevant to charting as the samples.

    The only unusual tihng I have is I have enabled all verbs (GET POST PUT etc) for ashx files, incase this help the MS team debug things.

  • jueves, 19 de febrero de 2009 13:45Chris.Swart Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Matt M19543 said:

    I've been getting this error as well and I found that it happens when I have a chart control set to display:none and later displays itself after a postback.  When I changed it to a visibility:hidden so that it's still rendering just not displaying it worked fine.  Luckily our current site design allowed this kind of change.  It looks like there's something that the chart control doesn't like about only being displayed after postbacks.



    I'm essential getting the same thing however I leave all my charts Visible="false"  and add a visible="true", empty chart and the exception isnt raised. Strange but true...



  • jueves, 05 de marzo de 2009 4:06Yee Jie NgMVPMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     

    Set Chart's properties (in design view), ImageStorageMode to UseImageLocation just works like charm for me.

  • jueves, 05 de marzo de 2009 18:14rickd59 Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    I tried editing the web config too with each person's suggestions, but no luck. Changing the ImageStorageMode (in design mode) to 'UseImageLocation' as just suggested fixed it for me. I had also dragged and dropped the original control onto my page and had it working great, tweaking whatever I wanted in the properties. I think it broke (as another user sugggested), when I then tried to programatically create a chart. After this I couldnt get working again until changing ImageStorageMode. Thanks for the great tip; WE ALL WIN!  :)

    -Rick
  • jueves, 12 de marzo de 2009 23:14Rekha Jaju Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     

    I am also facing problem on rendering the images on a load balancer. Any help would be appreciated.

  • lunes, 11 de mayo de 2009 20:23pvcr001 Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    thanks, this works
  • lunes, 11 de mayo de 2009 20:33bladerunner148 Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    If anyone still having problems, you can modify httpHandlers to something like this on your web.config.

    <

     

    add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

     

     

    validate="false" />

  • viernes, 15 de mayo de 2009 9:38Athar Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    I had the same problem but thx for your post, its really helpful and I did well
    thx.
  • viernes, 15 de mayo de 2009 20:38dcpt Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Thank Ng. Your tip works great.

    dcpt
  • miércoles, 27 de mayo de 2009 4:48GeoffMcIlraith Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    P.Looijmans solution worked for me...I had the chart controls in an update panel and was calling __doPostBack(UpdatePanelClientID, '') to trigger a refresh...Actually I added POST to both the HttpHander and the Handler, but that's probably just through ignorance :) .   
  • martes, 02 de junio de 2009 10:16ScottBailey Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    I gave NETWORK SERVICE write permissions to the site directory and it works.  My key="ChartImageHandler" is set to "storage=file;timeout=20;".
  • lunes, 08 de junio de 2009 5:17anne-13 Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    After setting this  <add key="ChartImageHandler" value="storage=file;timeout=20;" />

    i got this error: System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\vhosts\login.supertec.com\httpdocs\ChartPic_000002.png' is denied.
  • lunes, 08 de junio de 2009 6:52anne-13 Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     

    its working fine now, just give all permisions to root folder. Thanks

  • lunes, 12 de octubre de 2009 6:32Murthy AVR Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    thanks for the help....... after changing in the web.config, it's worked for me
  • viernes, 30 de octubre de 2009 13:51marc frost Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Thanks, this helped me solve the issue i was experiencing
  • viernes, 30 de octubre de 2009 16:11Cole Brand Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Oh my word, this is terrible advice.

    I could understand setting up a particular folder for reading/writing these images expressly for the benefit of cacheing them, but to give all-perms to the root folder of the website is just asking to get harmed in all sorts of foul ways.

    Please, never enable write access on folders which don't need it.

    Security 101.
    Please don't forget (and feel free to remind me) to post if you got the answer you wanted, and select who really answered your post when you do so future visitors will know too! Remember, this is .NET 4.0 in a .NET 3.5 world, you're a pioneer right now.