Long running report is failing to run after 5 min to extract output in excel

.Net mvc 4 application is using SSRS 2012 reporting service to extract report data in excel. We have below code snippet to extract data to excel.

 ServerReport rpt = new ServerReport
            {
                ReportServerUrl = new Uri(ViewBag.ReportServerUrl),
                ReportPath = ViewBag.ReportPath//,
            };
            //rpt.ReportServerCredentials = new NetworkCredential();
            rpt.SetParameters(parameters);
            string encoding;

            string deviceInfo =
                "<DeviceInfo>" +
                "  <OutputFormat>EXCELOPENXML</OutputFormat>" +
                "<HTMLFragment>true</HTMLFragment>" +
                "</DeviceInfo>";

            Warning[] warnings;
            string[] streams;

            return rpt.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);

Export to excel is failing for report having close to 3000 tabs. Same report is taking more than 30 min to run through SSRS and do not throw any error.

But when we run report through web application report run is failing exactly at 5 min.

below error is getting logged on webserver and reportserver log.

Web.configuration:

Message: The underlying connection was closed: An unexpected error occurred on a receive.

 

Title:System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

InnerException# 1 - Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

InnerException# 2 - Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Report server:

 

RunningJobContext.IsClientConnected; found orphaned request xuxj0j550czlk3il0ix30zrf

                              DataPrefetch abort handler called for Report with ID=. Aborting data sources ...

                              INFO: RunningJobContext.IsClientConnected; found orphaned request xuxj0j550czlk3il0ix30zrf

                              INFO: DataPrefetch abort handler called for Report with ID=. Aborting data sources ...

                              INFO: RenderForNewSession('/Shared Reports/Standard Reports/Compensation Detail')

We have confirmed all timeout in report server, web, sql and all are having correct values.

Please suggest.

September 8th, 2015 1:23am

Hi Ajit, 

Based on the error message, the cause of this issue may be the "SecureConnectionLevel" element has a wrong value. We can set the "SecureConnectionLevel" to 1 or 2 only when we configure the Report Server for SSL connections. Please refer to this thread: The underlying connection was closed: An unexpected error occurred on a send.

If you have any other question, please feel free to ask.

Regards,
Shrek Li

September 8th, 2015 7:20am

Hi Milan,

Thanks for your reply. I have verified all suggestion mentioned in attached link. but still no success.

  • Timeout at dataset is set to 0 as no timeout.
  • Default report execution timeout was set to 1800; for testing of this long running report it is set as Do not timeout.
  • SessionState in the web.config is having default timeout as 20 min. But reports are failing before 20 min.
  • DatabaseQueryTimeout timeout is set to 120 second. Query is executing with in this timeout period in sql server
  • SessionTimeout is set to 1800 (30 min) in SSRS user session
  • RecycleTime in report server configuration file is set to 720 min.
  • Execution timeout is set to 9000 and maxRequestLength is increased to 10240.

     <httpRuntime executionTimeout="9000"  maxRequestLength="10240"/>

      I will increase maxrequestlength further and will try again.

Regards,

Ajit K


Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 11:05pm

thanks Shrek. Setting SecureConnectionLevel value to 2 does not help. We are getting below error.

The underlying connection was closed: An unexpected error occurred on a receive.

September 9th, 2015 11:14pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics