locked
After IIS restart, images no longer served RRS feed

  • Question

  • On our production servers, we noticed after every IIS restart we see a rash of "The image is not found." errors from chartimg.axd.  I can reproduce this issue locally by creating an image, saving the url for that image, something like "/ChartImg.axd?i=chart_0_0.jpeg&g=aade6814bc764f3f8d1987765e6e0f80" and then restarting IIS.  Prior to the restart the image will serve fine, after the restart I begin seeing the errors.  I am storing the images in a local folder and can see that the chart_0_0.jpeg does exist when the error is being returned.

    My web.config setup looks like this both locally and on our production environment.  Our production environment is a web farm, but my dev environment is nothing special -- just my local box.  Is there anyway to get the chart handler to maintain the ability to find the images after IIS restarts or is this a limitation of the control?

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

    <appSettings>
       <add key="ChartImageHandler" value="storage=file;timeout=300;dir=<myDirectory>;deleteafterservicing=false;"
    />

    Any ideas would be appreciated.  This is causing between 10-60 errors on our live site per day and is currently our most common live site error.

    Monday, June 1, 2009 3:53 PM

Answers

  • Hi,

    Unfortunately this is a product bug which is already addressed in the next version. 

    The chart http handler cannot deliver images until at least one chart control is rendered in the current process.  For now I would suggest the following workaround - using global.asax to emulate chart rendering once before the chart handler is invoked:

            // This is Global.asax.cs
            static bool _chartInitialized;  
            protected void Application_BeginRequest(object sender, EventArgs e)
            {
                if (!_chartInitialized)
                {
                    _chartInitialized = true;
                    string s = ChartHttpHandler.Settings.FolderName;
                }
            }


    For more info please read this thread http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/31975aad-807d-4056-9910-03ce04a143be/

    Thanks,
    Delian
    Tuesday, June 2, 2009 7:12 PM
    Moderator

All replies

  • Hi,

    Unfortunately this is a product bug which is already addressed in the next version. 

    The chart http handler cannot deliver images until at least one chart control is rendered in the current process.  For now I would suggest the following workaround - using global.asax to emulate chart rendering once before the chart handler is invoked:

            // This is Global.asax.cs
            static bool _chartInitialized;  
            protected void Application_BeginRequest(object sender, EventArgs e)
            {
                if (!_chartInitialized)
                {
                    _chartInitialized = true;
                    string s = ChartHttpHandler.Settings.FolderName;
                }
            }


    For more info please read this thread http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/31975aad-807d-4056-9910-03ce04a143be/

    Thanks,
    Delian
    Tuesday, June 2, 2009 7:12 PM
    Moderator
  • When will the fix be available for ASP.Net 3.5?

    Also, DelianT, I noticed that you unmarked this as the answer.  Is there a better solution?

    Thanks,
    Steve Arthur
    Friday, September 25, 2009 4:22 PM
  • Has this next version been released?  I'm still using version 3.5.0.0.
    Monday, September 27, 2010 2:05 PM
  • I have the same issues, does anyone have a workaround or fix?
     The workaround above and on associated post do not resolve.
    • Edited by AndySummers Thursday, July 17, 2014 11:46 AM
    Thursday, July 17, 2014 11:38 AM
  • I'm having the same issue.  Have read various posts, but found no resolution.

    I'm getting "Image not found", only after a iisreset or application pool recycle and with web garden (ie. number of worker processes > 1).  However, subsequent requests for the chart rendering are ok.

    Tried all web.config settings mentioned everywhere and even the global.asax codes.

    Would upgrading to .Net 4 framework resolve the issue?  Had spent too much time on this trying to resolve the issue.

    Thursday, September 11, 2014 5:37 AM