我正在使用 SSRS 2014 生成报告并将其导出为 excel、word 格式。但是由于文件末尾有很多奇怪的行,无法打开excel/word文件(我用记事本打开)。
它只发生在大小 > 2MB 的 excel/word 文件中。 excel文件末尾奇怪的几行:
<html>
<head>
<title>Access to the path 'C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\RSTempFiles\RSFile_29dedb88-cf75-4908-8b9f-6a1b96c6f445' is denied.</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/ReportServer' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>Access to the path 'C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\RSTempFiles\RSFile_29dedb88-cf75-4908-8b9f-6a1b96c6f445' is denied.</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> Description: </b>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.
<br><br>
<b> Exception Details: </b>System.UnauthorizedAccessException: **Access to the path 'C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\RSTempFiles\RSFile_29dedb88-cf75-4908-8b9f-6a1b96c6f445' is denied**.
<br><br>ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
<br><br>To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code>
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.</code>
</td>
</tr>
</table>
<br>
<b>Stack Trace:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
[UnauthorizedAccessException: Access to the path 'C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\RSTempFiles\RSFile_29dedb88-cf75-4908-8b9f-6a1b96c6f445' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10573555
System.IO.File.Delete(String path) +377
Microsoft.ReportingServices.Library.<>c__DisplayClass10.<DeleteFileFromPartition>b__f() +106
Microsoft.ReportingServices.Diagnostics.<>c__DisplayClass4.<RunFromRestrictedCasContext>b__3(Object state) +235
System.Security.SecurityContext.runTryCode(Object userData) +247
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) +0
System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state) +10229150
Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.RunFromRestrictedCasContext(ContextBody callback) +142
Microsoft.ReportingServices.Library.PartitionManager.DeleteFileFromPartition(String path) +102
Microsoft.ReportingServices.Library.MemoryThenFileStream.DeleteFileIfOwner(Boolean disposing) +364
Microsoft.ReportingServices.Library.MemoryThenFileStream.Dispose(Boolean disposing) +82
System.IO.Stream.Close() +26
Microsoft.ReportingServices.Library.RSStream.Dispose(Boolean disposing) +90
System.IO.Stream.Close() +26
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +581
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +221
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +586
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +177
</pre></code>
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:2.0.50727.9031; ASP.NET Version:2.0.50727.9031
</font>
</body>
</html>
<!--
[UnauthorizedAccessException]: Access to the path 'C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\RSTempFiles\RSFile_29dedb88-cf75-4908-8b9f-6a1b96c6f445' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.Delete(String path)
at Microsoft.ReportingServices.Library.PartitionManager.<>c__DisplayClass10.<DeleteFileFromPartition>b__f()
at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.<>c__DisplayClass4.<RunFromRestrictedCasContext>b__3(Object state)
at System.Security.SecurityContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.RunFromRestrictedCasContext(ContextBody callback)
at Microsoft.ReportingServices.Library.PartitionManager.DeleteFileFromPartition(String path)
at Microsoft.ReportingServices.Library.MemoryThenFileStream.DeleteFileIfOwner(Boolean disposing)
at Microsoft.ReportingServices.Library.MemoryThenFileStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at Microsoft.ReportingServices.Library.RSStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response)
at Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->
当我删除那些行时,它可以正常打开。将报告导出为 PDF 或 CSV 时不会发生这种情况(即使它们的大小 > 40MB)
注意那些excel文件的记录只有14k左右,不超过excel的限制行数。
请帮帮我!提前谢谢了! 亲切的问候。