首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Stimulsoft时的“System.ArgumentNullException”

使用Stimulsoft时的“System.ArgumentNullException”
EN

Stack Overflow用户
提问于 2015-07-26 03:22:32
回答 1查看 801关注 0票数 2

我试图在我的MVC 5.2应用程序中使用Stimulsoft Reports 2014.3。当我尝试使用@Html.Stimulsoft().StiMvcViewer时,我会得到以下异常。

System.ArgumentNullException类型的异常发生在mscorlib.dll中 值不能为空。参数名称:键

我可以很好地使用@Html.Stimulsoft().StiMvcViewerFx。我尝试过在web.config中进行各种更改,以获得这个异常,但它们都是无用的。我还尝试过调试->异常,并检查了这两个框中的公共语言运行时异常,但没有任何其他异常。

添加@Html.Stimulsoft().RenderMvcViewerScripts()也没有用。

这是一种观点:

代码语言:javascript
复制
@using Stimulsoft.Report.Mvc
@using System.Web.UI.WebControls
@model Models.GenericReportViewModel

<div>
    @Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
    ActionGetReportSnapshot = string.Concat("LoadReport?Id=", Model.ReportName),
    Width = Unit.Point(500),
    Theme = StiTheme.Default,
    ActionExportReport = "ExportReport",
    Height = Unit.Point(400),
    Controller = "Report",
})
</div>

这是web.config:

代码语言:javascript
复制
  <system.web>
      <globalization uiCulture="fa-IR" culture="fa-IR"></globalization>
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="Stimulsoft.Base, Version=2014.3.0.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a" />
        <add assembly="Stimulsoft.Report, Version=2014.3.0.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a" />
        <add assembly="Stimulsoft.Report.Mvc, Version=2014.3.0.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a" />
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.5" />
    <pages>
      <namespaces>
        <add namespace="Kendo.Mvc.UI" />
        <add namespace="System.Web.Helpers" />
        <!--<add namespace="System.Web.Abstractions" />-->
        <add namespace="Stimulsoft.Base" />
        <add namespace="Stimulsoft.Report" />
        <add namespace="Stimulsoft.Report.Mvc" />
      </namespaces>
    </pages>
  </system.web>

我应该注意到,Flash版本的工作原理如下,它没有任何问题:

代码语言:javascript
复制
@using Stimulsoft.Report.Mvc
@using System.Web.UI.WebControls
@model Models.GenericReportViewModel

<div>
    @Html.Stimulsoft().RenderMvcViewerFxScripts()
    @Html.Stimulsoft().StiMvcViewerFx(new StiMvcViewerFxOptions()
{
    ActionGetReportSnapshot = string.Concat("LoadReport?Id=", Model.ReportName),
    Width = Unit.Point(500),
    Theme = StiMvcViewerFxOptions.Themes.Blue,
    ActionExportReport = "ExportReport",
    BackgroundColor = System.Drawing.Color.Silver,
    ActionGetLocalization = "GetLocal",
    Height = Unit.Point(400),
    Controller = "Report",
})
</div>

suggested将下面的bindingRedirect添加到web.config

代码语言:javascript
复制
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.1" />
  </dependentAssembly>

添加这将抑制异常并防止页面呈现,可能是因为我没有使用MVC 3!但这应该和这事有关。

我也把这个重定向作为oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0",但是我会得到这个异常。

EN

回答 1

Stack Overflow用户

发布于 2016-12-04 07:32:31

在web.config中的应用程序设置中添加这一行

代码语言:javascript
复制
<add key="PageInspector:ServerCodeMappingSupport" value="Disabled" />

也许您的报告文件是用不同版本的Stimulsoft创建的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31633320

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档