locked
Blank Chart in Production Hosted Environment - ChartImg.axd RRS feed

  • Question

  • Does anyone have any tips on overcoming this problem of Blank Charts in a Production Hosted Environment? The charts display no problem on my development machine, but dont show on the website in a hosted environment.

    Am using the following config setting in web.config

     <appSettings>
      <add key="ChartImageHandler" value="storage=file;timeout=20;deleteAfterServicing=false;dir=C:\[my hoster dir]\tempImageFiles;"/>
     </appSettings>

    Checking the file system, I can see that the chart images have been created (ie I can see that the charge image file gets created no problem, but the image does not render in the browser. Looking at the HTML source of the webpage gives me:

            <img id="StockChart" src="/ChartImg.axd?i=chart_0_0.png&amp;g=61299bee6c384f229bb19b091a782193" originalAttribute="src" originalPath="/ChartImg.axd?i=chart_0_0.png&amp;g=61299bee6c384f229bb19b091a782193" alt="" style="height:311px;width:399px;border-width:0px;" />

    Is ChartImg.axd supposed to be generated somewhere? Or is there another fix I can specify in the web config? I have tried different Trust levels and memoery/file switches on the storage parameter all to no effect.

    Thanks

    Monday, January 26, 2009 5:32 PM

Answers

  • If you deploy over IIS7 make sure that you have the ChartImageHandler registered in system.WebServer/handlers section. IIS7 have different http handlers model.
    Delian

    Tuesday, April 7, 2009 4:48 PM
    Moderator

All replies

  • ...it also creates a zero byte file msc_cntr_0.txt
    Monday, January 26, 2009 6:04 PM
  • OK. Looks like a problem with the hosting environment downloading *.png graphics. Works in another environment
    Tuesday, January 27, 2009 8:02 PM
  • In order to diagnose what is wrong with the chart images just copy the generated img src URL and hit the server with it to emulate image download. You can get an exception which can help you. 

     

    Wednesday, January 28, 2009 12:20 AM
    Moderator
  • Thanks. Useful tip. Looks as if it was a permission issue. Like I said, it worked in another environment anyways so I left this route.

    Thanks

    Wednesday, January 28, 2009 8:59 AM
  • I have a similar issue, for me its creating the files in the TempImageFiles but its not rendered on the page. i have given full control to the folder.

    any help is appreciated.

    Thanks
    Wednesday, March 18, 2009 4:28 PM
  • I am also having the same problem.  I have two production web servers in a web farm (load balanced).   When connected (with IE) to server one the image is dislayed, but when connencted to server two it is not.  Both servers have the exact same .aspx and web.config files.  With each server I can see that the image is created on the server (C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files)  by using the deleteAfterServicing=false setting and I have confirmed that both servers can display .png files.

    You would think that if it is a permissions problem with the temp directory that holds the image that it would be resolved by setting the ChartImageHandler storage to session or memory in the web.config.  When I do that, server one can still disply the image and server two cannot.

    Any suggestions would be greatly appreciated.

    Thanks.
    Wednesday, March 18, 2009 7:43 PM
  • MikeXB, in web farm images have to be stored in shared location so each of the servers can have access. Imagine that one of the servers creates the image, but the image retrieval is served by another server. In your web config you should set "dir=\\mysharedserver\tempImageFiles". You can also use session if you have session server.

    Regards,
    Delian

    Wednesday, March 18, 2009 8:36 PM
    Moderator
  • I tried Memory and Storage options but resulted in the same behavior. One other thing i observed is even before getting the data and rendering it on to the page, i mean on the page load, i am seeing an error icon and when i looked at the property of the image i can not find ChartImg.axd file not found.

    This is definitely an environmental issue as the same piece of code and application settings works well on my DEV env and not in System testing...will keep you posted!!


    I am confused with your issue as image gets created and rendered immediately, so why do you need to access the chart on the other server.

    thanks

    Sapkash

    Wednesday, March 18, 2009 8:57 PM
  • DelianT,

    There are a few reasons why I don't think that the web farm is causing the problem.

    1. The load balancing server locks the user into a specific server until a period of 30 minutes of inactivity is hit.  We have confirmed that while on the web site, it uses the files from only one server for the session.

    2. We use in-process session variables, and never have a problem with them.

    3. The charts always display when connected to server two and never display when connect to server one.  If it were a web farm issue I would expect both to have problems about half the time.

    Wednesday, March 18, 2009 9:13 PM
  • DelianT

    "In order to diagnose what is wrong with the chart images just copy the generated img src URL and hit the server with it to emulate image download. You can get an exception which can help you. "

    I tried you above suggeston, but accessing the axd file gives me a 404. Do you think i have issue creating axd file.

    Thanks
    Wednesday, March 18, 2009 9:19 PM
  • If you deploy over IIS7 make sure that you have the ChartImageHandler registered in system.WebServer/handlers section. IIS7 have different http handlers model.
    Delian

    Tuesday, April 7, 2009 4:48 PM
    Moderator
  • Hi Delian,

    i have similar issue and what you said is true i have a shared directory on server and i also have given path as you have mentioned but i get image not found and i dont see special code getting attached to image to identify machine to avoid collision . what am i doing wrong? does image url or image location property play any role?
    Thanks in Advance

    Mohammad A Lari


    Mohammad Lari
    Saturday, July 4, 2009 3:19 AM
  • Hi all,

    I had a similar problem: the image of the chart was generated but not shown.

    1) I fixed it by using Session as storage in web.config:

    <add key="ChartImageHandler" value="Storage=Session;Timeout=360;Url=~/TempImages/;"/>

    2) What also worked for me was:

    <add key="ChartImageHandler" value="Storage=file;Timeout=20;Url=~/TempImages/;"/>

    and setting ImageStorageMode Attribute of ChartControl to

    ImageStorageMode="UseImageLocation"

    Friday, July 10, 2009 8:53 AM
  • 2) What also worked for me was:

    <
    add
     key
    =
    "
    ChartImageHandler
    "
     value
    =
    "
    Storage=file;Timeout=20;Url=~/TempImages/;
    "
    />
    
    
    

    and setting ImageStorageMode Attribute of ChartControl to

    ImageStorageMode="UseImageLocation"


    Setting the ImageStorageMode to UseImageLocation just tells the chart control to ignore the ChartImageHandler setting completely. It doesn't fix the underlying issue.
    Tuesday, August 4, 2009 9:50 AM
  • Any other suggestions to this issue? I've tried all of the above but the chart still does not load, using 'UseImageLocation' does work but I don't want the files to be stored.

    Thanks,

    Jas

     

    Thursday, March 10, 2011 2:07 PM
  • After further investigation, it seemed there was another web.config file which wasn't updated with the relevant parts within the HTTPHandlers, appsettings and handlers section. After updating each section, the chart loaded successfully with the 'UseHTTPHandlers' enabled.
    • Proposed as answer by Jas10 Thursday, March 10, 2011 2:26 PM
    Thursday, March 10, 2011 2:26 PM
  • Would mind printing here your new web.config file content (with the relevant parts within the HTTPHandlers).

     

    Your help will be greatly appreciated.

    Sunday, March 13, 2011 1:49 AM
  •  

     

    Here you go:

    <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" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" 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>
    <appSettings>
    		<add key="ChartImageHandler" value="deleteAfterServicing=true;storage=file;timeout=20;dir=c:\TempImageFiles\;"/>
    	</appSettings>
    
    <system.web>
    		<httpHandlers>
    			<remove path="*.asmx" verb="*"/>
    			<add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    			<add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    			<add path="ScriptResource.axd" verb="GET,HEAD" 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>
    
    
    </system.web>
    

    Make sure you input the code into each web.config file you have.

    Hope it helps,

    Jas

     

     

    Tuesday, March 15, 2011 3:05 PM
  • I'm having the same issue as SapKash. 

    I have a Chart control that works perfectly in development environment. In production, it doesn't even render. It didn't create the image as well. The image is not created.

    The following keys have been added to web.config on their respective sections:

    On <handlers>: 

        

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

    On <appSettings>:

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

    I don't have any stack trace or exception message because sharepoint just gives me a "Unexpected error" message.

      
    Wednesday, May 7, 2014 4:26 PM