症状
请考虑以下情形:
- 您使用 SQL Server 2012、2014 或 2016 Reporting Services。
- 安装 Microsoft SQL Server 2014 Service Pack 1、SQL Server 2012 SP3 的更高累积更新或 SQL Server 2016 的累积更新。
- 运行以编程方式生成的 RDL 报告。
在这种情况下,你可能会收到类似于以下内容的错误消息:
注意
processing!ReportServer_0-1!1328!01/14/2016-10:58:06:: e 错误:抛出 Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: 报告处理中发生意外错误。 ---> System.IO.IOException:进程无法访问文件“C:\Users\ReportServer\AppData\Local\Temp\kpw4qafn.out”,因为另一个进程正在使用它。
at System.IO.__Error.WinIOError (Int32 errorCode, String maybeFullPath)
位于 System.IO.File.InternalDelete (字符串路径,布尔值 checkHost)
在 Microsoft.ReportingServices.RdlExpressions.VBExpressionCodeProvider.CompileAssemblyFromDomWithRetry (CompilerParameters 选项、CodeCompileUnit compilationUnit)
在 Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.InternalCompile (AppDomain compilationTempAppDomain, Boolean refusePermissions)
在 Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler。<>c__DisplayClass2。<编译>b__0 ()
在 Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext。<>c__DisplayClass1。<>运行b__0 (对象状态)
在 System.Security.SecurityContext.runTryCode (对象 userData)
在 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup (TryCode 代码、CleanupCode backoutCode、对象 userData)
在 System.Security.SecurityContext.Run (SecurityContext securityContext, ContextCallback callback, Object state)
在 Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run (ContextBody callback)
在 Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.Compile (IExpressionHostAssemblyHolder expressionHostAssemblyHolder, AppDomain compilationTempAppDomain, Boolean refusePermissions, PublishingVersioning versioning)
在 Microsoft.ReportingServices.ReportPublishing.ReportPublishing.Phase3 (ParameterInfoCollection& parameters, Dictionary'2& groupingExprCountAtScope)
在 Microsoft.ReportingServices.ReportPublishing.ReportPublishing.InternalCreateIntermediateFormat (Stream definitionStream, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocationLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]&dataSetsHash)
在 Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileOdpReport (PublishingContext reportPublishingContext, PublishingErrorContext errorContext, String& reportDescription, String& reportLanguage, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocationLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean&hasHyperlinks, Byte[]& dataSetsHash)
在 Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat (PublishingContext reportPublishingContext)
- 内部异常堆栈跟踪结束 -
注意 此错误也会记录在 Reporting Services 日志中。
解决方法
此问题已在 SQL Server 的累积更新中修复:
SQL Server 2016 RTM 的累积更新 5
SQL Server 2016 SP1 累积更新 2
SQL Server 2014 Service Pack 1 累积更新 9
SQL Server 2012 Service Pack 2 (SP2 的累积更新 16)
关于 SQL Server 的累积更新
SQL Server 的每个新累积更新都包含上一个累积更新中包含的所有修补程序和所有安全修补程序。 查看 SQL Server 的最新累积更新:
状态
Microsoft 已确认在 "适用于" 部分中所列的 Microsoft 产品中存在问题。
参考资料
了解 Microsoft 用于描述软件更新的术语。