10

当我尝试以 PDF/Excel/Word 格式导出报告或打印报告时,出现错误。错误描述:

Server Error in '/' Application.

Operation could destabilize the runtime. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.Security.VerificationException: Operation could destabilize the runtime.

源错误:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

堆栈跟踪:

[VerificationException: Operation could destabilize the runtime.]

[TypeInitializationException: The type initializer for 'System.Diagnostics.Activity' threw an exception.]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +153
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +336
   System.Collections.Generic.IList`1.get_Item(Int32 index) +0
   Microsoft.ReportingServices.ReportIntermediateFormat.TextBox.SetExprHost(ReportExprHost reportExprHost, ObjectModelImpl reportObjectModel) +101
   Microsoft.ReportingServices.OnDemandProcessing.OnDemandProcessingContext.RuntimeInitializeTextboxObjs(ReportItem reportItem, Boolean setExprHost) +74
   Microsoft.ReportingServices.OnDemandReportRendering.OnDemandPageEvaluation.InitializeEnvironment() +778
   Microsoft.ReportingServices.OnDemandReportRendering.OnDemandPageEvaluation..ctor(Report report) +84
   Microsoft.ReportingServices.OnDemandReportRendering.Report..ctor(Report reportDef, ReportInstance reportInstance, RenderingContext renderingContext, String reportName, String description) +100
   Microsoft.ReportingServices.ReportProcessing.Execution.RenderReportOdp.PrepareROM(RenderingContext& odpRenderingContext) +158
   Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.Execute(IRenderingExtension newRenderer) +306

[LocalProcessingException: An error occurred during local report processing.]
   Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings) +166
   Microsoft.Reporting.WebForms.LocalModeSession.RenderReport(String format, Boolean allowInternalRenderers, String deviceInfo, NameValueCollection additionalParams, Boolean cacheSecondaryStreamsForHtml, String& mimeType, String& fileNameExtension) +193
   Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +514
   Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +250
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +188
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1087.0

有任何想法吗。谢谢。

4

6 回答 6

4

我在过去两个月左右开始收到此消息,现在我想我找到了问题所在。

正如您在 Github 上的这个问题中看到的那样,使用 ApplicationInsights v2.4.0 时似乎存在问题,因为它引用了一个名为System.Diagnostics.DiagnosticsSource (v4.4.0)的 dll ,并且(如问题中所述)这个新引用导致了问题.

将它们复制到该文件夹​​的日期大约是两个月前(当这个问题开始发生在我身上时)。而且我无法在 DEV/QAS 中重现这个问题,因为这些环境中没有“安装”dll。

当我从我的应用程序的 bin 文件夹中删除这些 dll 时,问题就消失了。由于我的应用程序没有引用这些 dll,因此删除它们没有问题。

但是如果你不能删除它们,System.Diagnostics.DiagnosticsSource v4.5.0 似乎会解决这个问题,但它还没有正式发布。跟踪 Github 问题以获取更多详细信息。

于 2017-10-04T16:32:16.787 回答
4

这是我修复我的方法。

  1. 找到安装在 Web 项目中的 NuGet 包 System.Diagnostics.DiagnosticSource。我的已经是最新版本了。
  2. 将其降级到最后一个稳定版本。就我而言,它是 4.4.0。
  3. 降级完成后,再次升级到最新版本。重建解决方案并检查。我的错误消失了。

降级/升级过程更新了 web.config 中所需的项目以使其再次工作。

于 2017-10-17T16:58:51.417 回答
2

我遇到了同样的问题,并且能够通过在 ApplicationInsights.config 中注释掉 Microsoft.ApplicationInsights.Web.AspNetDiagnosticTelemetryModule 来解决它。

于 2018-01-09T15:04:27.297 回答
2

刚刚经历了这条消息的痛苦!我们在 azure 上使用 webroles,RDLC 是发票打印等关键事项的一部分。

对我们来说,答案是转到 webrole 的属性并关闭“启用诊断”。

ATM,这仍然支持 MSFT,所以不能给你一个理由,但这解决了我们 RDLC 实时处理的问题!希望这可以帮助某人问候彼得

于 2017-09-25T17:30:26.283 回答
-1

I had this issue too. Started to see this issue after I had upgraded NuGet packages in my application to the latest version. The application would worke fine on my development machine, but once I deployed the it to a production server I started to see this error when trying to access a ReportViewer page.

I ended up removing all ApplicationInsights NuGet packages in my application. This got rid of the reference to the System.Diagnostics.DiagnosticsSource dll and then my application started working normaly.

于 2017-11-24T16:09:00.940 回答
-1

我通过将我的 NuGet 包降级为:

Microsoft ReportViewer Runtime 2008 for Web Forms - 9.0.21022.8
于 2017-08-15T13:24:54.330 回答