简体   繁体   中英

ASP.net 4.0 Chart Control IIS6 Images not being displayed

Here is my problem, have a Web Application that is being hosted using a Web Farm and Load balancer. The application is running on Framework 4.0, Windows 2003 server and IIS6. Our local host environment is Windows 7 and IIS7.

We noticed intermittent exceptions "The image is not found"and noticed the Web.config was pointing at 3.5

So we made a change to the web.config to point at 4.0

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

We are also using a network share to store the chart images which is set in appSettings

<add key="ChartImageHandler" value="storage=file;timeout=300;dir=\\server\webdata\charts\;deleteAfterServicing=false;"/>

after making the changes in the web.config the images would not display on the production server running IIS6 or my local environment running IIS7. So I made a change in all the webforms using the chart control and added ImageStorageMode="UseImageLocation".

After making that change the chart images displayed in IIS7 and IIS6 but in production IIS6 they were being placed in the webform directory and ignoring the handler location (Network Share). My local environment is working fine but I cannot get the production setting correct. All my web.config settings are below and any help would be greatly appreciated.

<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=300;dir=\\SERVER\webdata\charts\;deleteAfterServicing=false;"/>
</appSettings>

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

<compilation debug="true" defaultLanguage="vb" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>

<!--IIS 7 Handler Section-->
<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>

Since you use load balancing on servers, it is maybe not finding the correct image location. Why don't you try to use a session to store the images?

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

Reference this for more info. We were having the same issue on a web farm. It would be wise to add deleteAfterServicing set to true.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM