lkosson / reportviewercore

Recompilation of Microsoft.ReportViewer for .NET Core 3.1+
427 stars 123 forks source link

Timeout after 10 minutes regardless of the timeout set #149

Closed krjaction50 closed 1 year ago

krjaction50 commented 1 year ago

We are using this package while porting our application from .NET 4.8 to .NET 6. We find that no matter what timeout we set, we get the following error at 10 minutes.

Here is the error, we believe it's coming from the WCF binding on the client-side inside of this component.

System.TimeoutException: The request channel timed out attempting to send after 00:10:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.
---> System.TimeoutException: The HTTP request to 'http://atmtqadb04/ReportServer_AOINST1/ReportExecution2005.asmx' has exceeded the allotted timeout of 00:10:00.

Here is the code.

                _serverReport.ReportPath = _reportPath + report.ReportName;
                _serverReport.Refresh();
                _serverReport.SetParameters(report.ReportParameters);
                _serverReport.Timeout = 3600 * 1000; // still times out after 10 minutes

                string format = report.Format.ToString();
                if (report.Format.ToString().ToUpper() == "EXCEL" && GeneralServicesFacade.Instance.GetAppSetting("ExcelVersion") != null && GeneralServicesFacade.Instance.GetAppSetting("ExcelVersion").ToString().ToUpper() == "XLSX")
                    format = "EXCELOPENXML";

                if (report.SaveBytes(filename, _serverReport.Render(format, null, out mimeType, out encoding, out report.FileExtension, out streamIDs, out warnings)))
                {
lkosson commented 1 year ago

As far as I can tell, ServerReport.Timeout is correctly passed to OpenTimeout, ReceiveTimeout and SendTimeout of Binding. Setting Timeout to some low value (like 1 ms) causes instant timeout.

Keep in mind that SetParameters issues first request to Reporting Service, so you should set your timeout before that.

krjaction50 commented 1 year ago

We've tried that as well, no joy, we still get a timeout after 10 minutes.

lkosson commented 1 year ago

Try reproducing the behavior using ReportViewerCore.Sample.WinFormsServer sample project in this repo.

krjaction50 commented 1 year ago

Will do.

krjaction50 commented 1 year ago

When building the solution in VS 2022 I get these error messages. Is there something I can set to eliminate these?

Severity Code Description Project File Line Suppression State Error MSB3821 Couldn't process file Microsoft.Reporting.Chart.WebForms\Commands.ChartTypes.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files. Microsoft.ReportViewer.DataVisualization C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 3312

lkosson commented 1 year ago

If you have downloaded the project as a ZIP file instead of cloning it as a git repo, check the "unlock" checkbox in the file properties before extracting it.

krjaction50 commented 1 year ago

Regardless of what we set the timeout to, it always times out at 10 minutes. We also set the timeout to 3 seconds and run a report that takes one minute and it does NOT timeout on the client. While we downloaded and walked the code, we do see the timeouts being set on the binding, but it doesn't matter so something seems wrong here. We have not got a chance to use the WinForm project yet.

lkosson commented 1 year ago

Try setting much lower timeout (like 1ms) and see if it then times out. Also post a full stack trace of the thrown exception and try reproducing the behavior in the sample project.

krjaction50 commented 1 year ago

What we found is that you have to set the timeout before making ANY calls on the object. I'm not sure why it's that way, but it is and we are up against a deadline and don't have time to dive deep into why. Bottom line, if you set the timeout before any method it will be honored. This is a change in behavior from the .NET Framework ReportViewer.