question

TrucSangHue-0187 avatar image
0 Votes"
TrucSangHue-0187 asked Joyzhao-MSFT commented

SSRS 2014 Errors in exporting to Excel, Word file but no error for PDF, CSV

Hello,

I am using SSRS 2014 to generate report and export it in excel, word format. But the excel/word file could not be opened due to many strange lines at the end of file (I open it with notepad).
It only happens for the excel/word files having size > 2MB. The strange lines at the end of the excel file:

 <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 &lt;identity impersonate=&quot;true&quot;/&gt;, 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 &quot;Properties&quot; and select the Security tab. Click &quot;Add&quot; 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.&lt;&gt;c__DisplayClass10.&lt;DeleteFileFromPartition&gt;b__f() +106
    Microsoft.ReportingServices.Diagnostics.&lt;&gt;c__DisplayClass4.&lt;RunFromRestrictedCasContext&gt;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&amp; completedSynchronously) +177
 </pre></code>
    
                   </td>
                </tr>
             </table>
    
             <br>
    
             <hr width=100% size=1 color=silver>
    
             <b>Version Information:</b>&nbsp;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)
 -->

When I remove those lines, it can be opened normally. It does not happen when export report to PDF or CSV (even their size > 40MB)
Note that the records of those excel files are just around 14k rows not exceed the limited rows of excel.

Please help me! Many thanks in advance!
Kind regards.

sql-server-reporting-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Joyzhao-MSFT avatar image
0 Votes"
Joyzhao-MSFT answered Joyzhao-MSFT commented

Hi @TrucSangHue-0187 ,
What versions of Excel and Word renderers are you using? As far as I know, Microsoft Excel 2003 rendering extension and Microsoft Word 2003 (.doc) rendering extension are deprecated. Does it display properly when you export to PowerPoint format? Do you export the report in the web portal or export the report in vs or ReportBuilder?
Best Regards,
Joy


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Joy,
As it exported the xlsx extension, I think it's Microsoft Excel 2007. We are using SSRS 2014, there is no Power point format export.
The export is done in web portal. Only Microsoft format file (excel, word) which > 2 MB size has that issue (the issue of having strange lines at the end of file, I can open the file after removing them)

Thanks for your help!
Hue

0 Votes 0 ·

You could try to download the report on a different computer. I think it is a problem with the versions of Excel and Word. This phenomenon occurs when the file is too large.

0 Votes 0 ·