ASP.NET图表控件不再与.NET 4中工作图表、控件、工作、ASP

2023-09-07 12:49:59 作者:萌辣

我刚刚升级到.NET 4,我的ASP.NET图表控件将不再显示。

I've just upgraded to .NET 4 and my ASP.NET Chart Control no longer displays.

有关.NET 3.5,由控制产生的HTML来是这样的:

For .NET 3.5, the HTML produced by the control used to look like this:

<img id="20_Chart" src="/ChartImg.axd?i=chart_5f6a8fd179a246a5a0f4f44fcd7d5e03_0.png&amp;g=16eb7881335e47dcba16fdfd8339ba1a" alt="" style="height:300px;width:300px;border-width:0px;" />

而现在,对于.NET 4,它看起来像这样(请注意在源路径的变化):

and now, for .NET 4, it looks like this (note the change in the source path):

<img id="20_Chart" src="/Statistics/Summary/ChartImg.axd?i=chart_5f6a8fd179a246a5a0f4f44fcd7d5e03_0.png&amp;g=16eb7881335e47dcba16fdfd8339ba1a" alt="" style="height:300px;width:300px;border-width:0px;" />

下图是在一个MVC局部视图是在一个名为统计和MVC意见MVC区文件夹文件夹,名为摘要(即/区/统计/浏览/摘要),因此这显然是在哪里路径的变化是来自。

The chart is in an MVC partial view that is in an MVC Area folder called "Statistics" and a MVC Views folder called "Summary" (i.e. "/Areas/Statistics/Views/Summary"), so this is obviously where the change of path is coming from.

我所要做的就是将System.Web.DataVisualization组装开关,从3.5到4.0。

All I've done is to switch the System.Web.DataVisualization assembly from, 3.5 to 4.0.

任何帮助非常AP preciated。

Any help greatly appreciated.

推荐答案

谢谢您的回答,但我不认为我是一个IIS6 / IIS7的问题。

Thanks for your answers, but I don't think mine was an IIS6/IIS7 problem.

我跟踪到这样一个事实: ImageStorageMode 的默认值在 ChartControl 从 UseImageLocation 到 UseHttpHandler 。我的 ChartControl 现在有一些额外的属性和一切工作正常。

I traced it to the fact that the default value for ImageStorageMode on a ChartControl has changed from UseImageLocation to UseHttpHandler. My ChartControl now has some extra attributes and all works fine.

<asp:Chart ... ImageStorageMode="UseImageLocation" ImageLocation="/Temp/ChartPic_#SEQ(300,3)">

我也不得不(通过添加 /温度/ )作为修改 ImageLocation 以非亲属还遍历时,引起了问题 ChartControl 数据点在一些code-落后。

I had to also change the ImageLocation to be non-relative (by adding /Temp/) as that also caused a problem when iterating over the ChartControl's DataPoints in some code-behind.