gpt4 book ai didi

ASP.NET MVC3 图表 Web 帮助程序在 IIS7 上托管时不起作用

转载 作者:行者123 更新时间:2023-12-02 10:48:34 24 4
gpt4 key购买 nike

我正在使用 System.Web.Helpers 程序集中提供的新图表帮助器方法,如下所示

http://www.dotnetcurry.com/(X(1)S(jm1obicbiav03qq3dnxug2ap))/ShowArticle.aspx?ID=597&AspxAutoDetectCookieSupport=1

当我在 Visual Studio 的内置服务器中运行该应用程序时,它工作得很好。但是,当我将网站发布到本地计算机上 IIS 中的虚拟目录时,图像没有显示,而是显示了一个“红叉”标记。

我没有使用任何相对路径,并且服务器上提供静态内容,因为我可以在发布时看到其他图像在我的应用程序中正确显示。

这是我的观点

{img src="/Home/GetRainfallChart"alt="图表"/}

这就是 Action

    public ActionResult GetRainfallChart()
{

var key = new Chart(width: 600, height: 400).AddSeries(
chartType: "area",
legend: "Rainfall",
xValue: new[] { "Jan", "Feb", "Mar", "Apr", "May" },
yValues: new[] { "20", "20", "40", "10", "10" })
.Write();
return null;
}

发布时我还需要复制任何 dll 吗?

最佳答案

找到解决办法

需要执行此操作才能在虚拟目录上托管时在 IIS 上工作

<img src = <%= Url.Content("~/Home/GetRainfallChart") %>" alt="chart" />

关于ASP.NET MVC3 图表 Web 帮助程序在 IIS7 上托管时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4797548/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com