ASP.NET 图表控件无法在生产服务器上运行

发布于 2024-12-12 16:27:13 字数 1998 浏览 0 评论 0原文

我有一个严重依赖图表的应用程序,目前图表可以在 ASP.Net 开发服务器中工作,但是当我尝试发布到我的服务器(Win 2008 Server R2、IIS 7)时,图表不显示。

使用 Firebug,我可以看到对 ChartImg.axd 的调用返回 404,而我在 IE 中得到的只是一个空白图像容器,或者在 Firefox 中什么也没有。到目前为止,我已经搜索了大约 3 或 4 个小时,并尝试了几乎所有推荐的内容,但似乎没有任何效果。

我想使用内存/HttpImageHandler,而不是 ImageLocation 配置。

我的 Web.Config

    <appSettings>
    <!--<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />-->
    <add key="ChartImageHandler" value="storage=memory;timeout=20;deleteAfterServicing=false" />
  </appSettings>
  <system.webServer>
    <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>
  <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>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
          assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </controls>
    </pages>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    <customErrors mode="Off"/>
  </system.web>

有谁知道我在哪里出错以阻止它在我的服务器上运行?

I have an application that relies heavily on charting and currently the charts will work in the ASP.Net Development Server, but when I try to publish out to my server (Win 2008 Server R2, IIS 7), the charts do not show up.

Using Firebug, I can see that the call to ChartImg.axd returns a 404, and all I get is a blank image holder in IE, or nothing in Firefox. I've searched for about 3 or 4 hours so far, and have tried just about everything recommended, but nothing seems to be working.

I would like to use memory/HttpImageHandler, instead of the ImageLocation configuration.

My Web.Config

    <appSettings>
    <!--<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />-->
    <add key="ChartImageHandler" value="storage=memory;timeout=20;deleteAfterServicing=false" />
  </appSettings>
  <system.webServer>
    <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>
  <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>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
          assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </controls>
    </pages>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    <customErrors mode="Off"/>
  </system.web>

Does anyone have any ideas where I'm going wrong to keep this from working on my server?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

熟人话多 2024-12-19 16:27:13

我找到了问题的答案,但我相信我的问题具体源于我的代码的运行方式。

一旦我在 ChartImageHandler 的 appSettings 下设置了 privateImages=false ,使用带有文件存储的 ImageLocation 或带有内存存储的 HttpHandler,我的图像就没有问题了。

我查看了列表 这里并意识到我的代码没有以下内容:

  • 身份验证
  • SessionID
  • AnonymousID,

因此privateImages=true的隐式默认设置使我无法下载我的图像。当我设置 privateImages=false 时,我没有遇到任何问题,并且图表工作正常。我将应用程序设置为使用 Windows 身份验证,并设置 privateImages=true,现在使用图像位置设置或 HttpHandler 设置生成我的图表。

希望这会有所帮助。我知道我花了很长时间四处挖掘却一无所获。

I found the answer to my problem, but I believe that my problem stemmed specifically from how my code runs.

Once I set privateImages=false under appSettings for my ChartImageHandler, my images came up with no problem, using ImageLocation with file storage or HttpHandler with memory storage.

I looked at the listing here and realized that my code has NONE of the following:

  • Authentication
  • SessionID
  • AnonymousID

so the implicit default setting of privateImages=true was keeping me from downloading my images. When I set privateImages=false I had no problems and the charts worked correctly. I set my application to use Windows Authentication, and set privateImages=true and my charts are now being generated with either the Image Location setting or the HttpHandler setting.

Hopefully this is helpful. I know I spent a long time digging around and got nowhere.

撩发小公举 2024-12-19 16:27:13

这个配置对我有用。您需要使用内存作为存储。

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

This configuration work for me. You need to use memory as storage.

< add key="ChartImageHandler" value="storage=memory;deleteAfterServicing=true;timeout=20;"/>
噩梦成真你也成魔 2024-12-19 16:27:13

这似乎是安全/权限问题。您是否将图表保存到本地文件夹,然后为该文件夹的 IIS 用户和/或网络服务用户分配写入权限。

It seems like security/permission issue. Are you saving charts to local folder, then assign write permission for IIS user and/or network services users for that folder.

神经大条 2024-12-19 16:27:13

在您的网络服务器上安装 Microsoft 图表控件或尝试以下操作:

共享托管环境上的 ASP.Net 图表控件

运行时还要检查 HttpHandler 是否已在 web.config 中的 system.webServer 中注册IIS 7。

Install the Microsoft Chart Controls on your webserver or try this:

ASP.Net Chart Control On Shared Hosting Environment

Also check that the HttpHandler is registered in system.webServer in your web.config when running under IIS 7.

如果没结果 2024-12-19 16:27:13
  <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
          assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </controls>

试试这个:将 Version=4.0.0.0 更改为 Version=3.5.0.0

  <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
          assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </controls>

try this: change Version=4.0.0.0 to Version=3.5.0.0

塔塔猫 2024-12-19 16:27:13

尝试这个,它在 web.config 运行时错误的情况下得到了解决

<前><代码><前>;
<添加键=“ChartImageHandler”值=“存储=内存;超时= 20;deleteAfterServicing=true;Url=~\temp\”

/>

try this it was resolved in case of web.config runtime error

<pre>
<add key="ChartImageHandler" value="storage=memory;timeout=20;deleteAfterServicing=true;Url=~\temp\"

/>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文