ASP.Net and MVC Charts

I am trying to return a diagram in MVC ActionResult as a view model, but I find the following error:

CS0012: The type 'System.Web.UI.DataVisualization.Charting.Chart' is defined in an assembly that is not a reference. You must add a link to the assembly 'System.Web.DataVisualization, Version = 4.0.0.0, Culture = Neutral, PublicKeyToken = 31bf3856ad364e35'.

The project I'm writing is in MVC3, using Razor as superscript markup (which shouldn't matter, right?). I have included the following ads in my Web.Config

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
      <handlers>
          <!-- Microsoft Chart Controls -->
          <add name="ChartImg" 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" />
          <add name="ReportViewerWebControl" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler,     Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"   />
      </handlers>
  </system.webServer>

My ActionResult code is pretty vanilla:

[HttpGet]
public ActionResult Visits()
{
    StatModel model = new StatModel();
    return View(model);
}

And the view in question is as follows:

@foreach (Chart chart in Model.ColumnCharts)
{ 
    @chart
}

, , , , , , System.Web.DataVisualisation ( 4.0.0.0). ?

+3
3

System.Web.UI.DataVisualization.Charting.Chart GAC? GAC. , DLL bin , .

, , , , , web.config .

<assemblies>
        <add assembly="System.Web.UI.DataVisualization.Charting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=<YourPublicKeyToken>(31bf3856ad364e35)"/>   
</assemblies>

,

+3

dll webconfig? Visual Studio , .

+1

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


All Articles