I've added the new Chart control to my project and it works well. I've set the
<add key="ChartImageHandler" value="storage=memory;timeout=20;" />
<handlers>
<add name="ChartImg" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
Everything is fine as long as I use the "/host/Poll.aspx" path in my browser. Things break when switching over to the rewritten URL "host/poll/". I am getting the "System.Web.HttpException was unhan开发者_运维问答dled by user code Message=Error executing child request for ChartImg.axd." exception.
Any ideas how to fix it? Thank you very much!
I cant actually try this at the moment but how about "~/ChartImg.axd"
Failing that try using image locations
<add key="ChartImageHandler" value="Storage=file; Timeout=20; Url=~/Temp/Charting/;"/>
Edit: And update your chart html
<asp:Chart ID="chrt1" runat="server" Width="550px" Height="400px"
SuppressExceptions="True" ImageStorageMode="UseImageLocation"
ImageLocation="~/Temp/Charting/ChartPic_#SEQ(1000,30)">
And make sure the directory you are writing to exists. I normally do this on app start in the global
in case you upgrade your website from .Net 3.0 to .Net 4.0 and using IIS 7 you must insert some line in your webconfig like here :
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<remove name="ChartImageHandler"/>
<add name="ChartImageHandler" preCondition="integratedMode" verb="*" 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>
精彩评论