ASP.NET MVC3 Chart Web Assistant Doesn't Work When Hosted on IIS7

I am using the new helper diagram method available in the System.Web.Helpers assembly, as shown here.

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

It works great when I run the application on the integrated visual studio server. But when I publish the website in a virtual directory in IIS on my local computer, the image does not appear and the "red cross" icon appears in its place.

I do not use any relative paths, and static content is available on the server, as I can see how other images are displayed in my application, displayed properly.

Here is my look

          {img src = "/ Home / GetRainfallChart" alt = "chart" /}   

This 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;
    }

Do I need to copy any DLLs when publishing?

+3
source share
1 answer

Solution found

You need to do this to work with IIS when placed in a virtual directory

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

Source: https://habr.com/ru/post/1787774/


All Articles