0

There are 2 projects within the MVC solution. A web app and a report app. Reports are on demand from the web app. Web app runs fine with the inclusion of a timeout in the reporting controller. (_context.Database.SetCommandTimeout(300);).

If I run any of the reports or a WCF job I get the following errors, BUT if I run them immediately again they run ok. If I wait till the next day I get the same results.

Seems to be a common problem related to Reporting Services but I have run out of ideas.

Reporting Error: AggregateException: One or more errors occurred. (The request channel timed out attempting to send after 00:01: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.Threading.Tasks.Task.GetResultCore(bool waitCompletionNotification)

TimeoutException: The request channel timed out attempting to send after 00:01: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.Runtime.AsyncResult.End(IAsyncResult result) in AsyncResult.cs, line 354.

WCF Error: TimeoutException: The HTTP request to 'http://keeper/ReportServer/ReportExecution2005.asmx' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.

System.ServiceModel.Channels.HttpChannelFactory+HttpClientRequestChannel+HttpClientChannelAsyncRequest.SendRequestAsync(Message message, TimeoutHelper timeoutHelper) in HttpChannelFactory.cs, line 1048

TimeoutException: The request channel timed out attempting to send after 00:01: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.Runtime.AsyncResult.End(IAsyncResult result) in AsyncResult.cs, line 354.

Have added a web.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore requestTimeout="00:30:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
    </system.webServer>
  </location>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding openTimeout="00:10:00"
                 closeTimeout="00:10:00"
                 sendTimeout="00:10:00"
                 receiveTimeout="00:10:00"
                 maxBufferPoolSize="2147483647" 
                 maxReceivedMessageSize="2147483647">
        </binding>
      </wsHttpBinding>
      <basicHttpBinding>
        <binding openTimeout="00:10:00"
                 closeTimeout="00:10:00"
                 receiveTimeout="00:10:00"
                 sendTimeout="00:10:00"
                 maxBufferPoolSize="2147483647"
                 maxReceivedMessageSize="2147483647"
                 maxBufferSize="2147483647">
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

The requestTimeout="00:30:00" stopped the WCF job falling over so now either doesn't start or runs to completion. Nothing else in the web.config seemed to affect the results.

Have also looked at C:/Program Files/Microsoft SQL Server Reporting Services/SSRS/ReportServer/rsreportserver.config file but cant see any time outs which might relate to the 00:01:00 problem.

4/12/2020 Have changed the web.config file to:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  
  <location path="." inheritInChildApplications="false">
    
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore startupTimeLimit="600" shutdownTimeLimit="600" requestTimeout="00:30:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
    </system.webServer>
  
    <system.serviceModel>
      
      <bindings>
        <basicHttpBinding>
          <binding name="ServiceReference1"
                   openTimeout="00:10:00"
                   closeTimeout="00:10:00"
                   receiveTimeout="00:10:00"
                   sendTimeout="00:10:00"
                   maxBufferPoolSize="2147483647"
                   maxReceivedMessageSize="2147483647"
                   maxBufferSize="2147483647">
          </binding>
        </basicHttpBinding>
      </bindings>

      <services>
        <service name="ServiceReference1">
          <endpoint address="http://Keeper/ReportServer/ReportExecution2005.asmx"
                    binding="basicHttpBinding"
                    bindingConfiguration="ServiceReference1"
                    contract=""/>
        </service>
      </services>
      
    </system.serviceModel>
    
  </location> 
  
</configuration>
enter code here

Latest web.config 6/12/2020

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore requestTimeout="00:30:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
    </system.webServer>
  </location> 
</configuration>
  • Theobald, thanks for the reply. I am a newbe at this (an old mainframe programmer) so please bare with me. My end point for the WCF is ReportExecution2005.asmx. Not sure about Reports as that is buried in AlanJuden's code. Think you mean I need mods to the web.config file to define bindings within this end point. What would it look like please ? – Rod Foulcher Nov 18 '20 at 00:57
  • Have read the article (and am now quite confused). Changed my web.config file to::include: – Rod Foulcher Nov 20 '20 at 00:27
  • sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"> – Rod Foulcher Nov 20 '20 at 00:28
  • NO CHANGE in error (rerun is still ok) and still cant figure out where the 1:00min is coming from. Any help would be appreciated. – Rod Foulcher Nov 20 '20 at 00:30
  • It doesn't seem to matter whether I run a report or the WCF function first. Once I have 1 working the other works. It is as if the first to run (which falls over) wakes up Reporting Services. – Rod Foulcher Nov 20 '20 at 00:34
  • I get the feeling my web.config is not correct. How do I ... 'increase the timeout property and apply it to the endpoint.' ? – Rod Foulcher Nov 26 '20 at 05:47
  • You need to specify a name for the binding, and then specify the binding configuration as your binding in the endpoint node. Such as – Theobald Du Nov 26 '20 at 08:11
  • Have changed part of web.config to: – Rod Foulcher Nov 30 '20 at 00:48
  • NO CHANGE. Note am trying to use 10 min timeout (not 1 min) but not honoring it (or not seeing it). Also tried changing site settings to 'No Timeout'. Still no change. Can only test this once or twice a day as once it works all of it works. Think this is the wrong approach. Can you see anything wrong with my web.config ? – Rod Foulcher Nov 30 '20 at 00:54
  • I want to know what specific changes you have made to the configuration file, you can put the new configuration file into question by edit it. – Theobald Du Dec 03 '20 at 06:26
  • Thanks Theobald. Didnt know I could do that. Have also changed the CommandTimeout from 300 to 600. Will test tomorrow. Info: If I test with IIS (and get it running after several tries) and then Publish and test in production it will work immediately (both Reports and WCF Function) but fail the next day. Makes me think it is all to do with Reporting Services. – Rod Foulcher Dec 04 '20 at 04:01
  • @Theobold. NO CHANGE today. Behavior still the same. In development IIS falls over on first run of (large) report (and WCF function) but both work on second. My work around at present is to run a very small report (which will work) and then all other reports and functions run ok. Not very satisfactory. – Rod Foulcher Dec 05 '20 at 04:42
  • @Theobold. Can now duplicate the timeout errors: Open solution in VS, F5 to use IIS and open web app in browser to Main Menu. Go to Services: Stop/start SQL Server Reporting Services. Wait a minute or so (otherwise you get a ReportExecution2005.asmx not available error). In web app run report (any report). It will fail with 1 min Timeout errors as previously detailed (in about 60-80 seconds). Back Arrow, refresh Main Menu and run same report again. Report runs successfully (in about 45 seconds). – Rod Foulcher Dec 06 '20 at 23:54
  • Same test with WCF job gives same result. Both use Reporting Services. Have repeated these tests many times in both Dev and Prod. Dont know why. (Apart from the fact there is only 1 Reporting Services so both environments use it). Have reverted to simple web.config (see bottom of question) as it has no bearing on results (apart from requestTimeout="00:30:00" in aspNetCore which stops WCF job falling over half way thru). – Rod Foulcher Dec 06 '20 at 23:55
  • The problem is the RecycleTime in the rsreportserver.config file. (see earlier for location). The default is 720 mins (12hrs) so I get the same problem every day. This stop/starts Reporting Services twice a day and there is an initialisation time within Reporting Services immediately on first report run after that. In my case this gives the 1:00 Timeout Error documented earlier. See https://stackoverflow.com/questions/48866102/why-does-ssrs-need-to-recycle-the-application-domain for info. – Rod Foulcher Dec 07 '20 at 23:29
  • As a test I temporarily changed the RecycleTime to 10 minutes, restarted Reporting Services and it behaves as you would expect.(Run report - fail,ok,ok,10 min elapse,fail,ok,ok etc) After reading (a lot) it seems the 720 min RecycleTime is necessary (recommended) so the solution to my problem seems to be to automatically run a small job each Reporting Services restart. Dont know how to do that yet but will document as I go. – Rod Foulcher Dec 07 '20 at 23:30
  • First Step: Changed RecycleTime in rsreportserver.config file from 720 min to 10080 min (1 week). Restarted Reporting Services. Thursday. Ran 2 test jobs (a Report job and a WCF job). First time fail and then reruns all ok. Report takes about 20 secs. WCF job about 2 mins. Retested Friday with no further changes or Reporting Services restart. Test jobs both ran successfully (first time) and took about the same times. – Rod Foulcher Dec 11 '20 at 00:27

2 Answers2

0

In your configuration file, I don't see your endpoint, and the timeout attribute of binding is not applied to the endpoint. From the error report, it seems to be the problem of the timeout attribute.

For different timeout attributes, the most important is sendTimeout, which represents the time the client waits for a response from the WCF service.

OpenTimeout is the time you are willing to wait when opening a connection with the WCF service.

Similarly, closeTimeout is the time to wait before closing the connection (putting the client proxy) before waiting for an exception to be thrown.

ReceiveTimeout is the time that will be given to the client to receive and process the response from the server.

You can try to increase the timeout property and apply it to the endpoint.

For how to configure the endpoint in wcf, you can view this link:Configuring Services Using Configuration Files

Theobald Du
  • 824
  • 4
  • 7
0

As stated in comments, the RecycleTime in the rsreportserver.config file triggers a restart of the service SQL Server Reporting Services. Every time this happens there is an initialisation of Reporting Services required and this is triggered by the first report run after that event. This initialisation takes around 2 mins and (for me) results in a 1 min Timeout Error as reported earlier.

Still have no idea where this timeout comes from but here is the workaround thanks to Pavel and https://pawlowski.cz/2011/07/31/solving-issue-long-starting-report-ssrs-2008/

Basically this means: set the RecycleTime to 1500 (25 hrs), create a scheduled task to to run daily each morning which triggers a Powershell script to restart Reporting Services and then access the Reporting Services folder to initialise it. Note: I only have 1 Reporting Services for both localhost and production. If you have 2 you may need 2 jobs.

Pavel's commands for a Powershell script:

  1. Stop-Service "SQL Server Reporting Services (MSSQLSERVER)"
  2. Start-Service "SQL Server Reporting Services (MSSQLSERVER)"
  3. $wc = New-Object system.net.webClient
  4. $cred = [System.Net.CredentialCache]::DefaultNetworkCredentials
  5. $wc.Credentials = $cred
  6. $src = $wc.DownloadString("http://localhost/Reports/Pages/Folder.aspx")

I have used the following and included it in my solution to keep it all together:

  1. echo "Restarting SQL Server Reporting Services"
  2. Restart-Service "SQL Server Reporting Services"
  3. Start-Sleep -s 30
  4. echo "SQL Server Reporting Services available"
  5. $wc = New-Object system.net.webClient
  6. $cred = [System.Net.CredentialCache]::DefaultNetworkCredentials
  7. $wc.Credentials = $cred
  8. echo "Reporting Services Initialisation Starting"
  9. $src = $wc.DownloadString("http://keeper/ReportServer/Reports")
  10. echo "Reporting Services Initialisation Finished"
  11. Start-Sleep -s 30
  12. echo "Startup Finished"

This takes about 3 mins to run. I have noticed that Reporting Services takes about 15 secs to become available after a restart so that is why I have a sleep at step 3. Step 9. I am fairly sure that 'localhost' will work the same as your server name ('keeper' in my case). You only need the folder, not an actual report. Step 11 is just in case initialisation has not quite finished. At 2 am I dont care about a few extra minutes. The echos are for testing.

I have used Task Scheduler with the following settings: General; Name SSRS_Startup Triggers: Daily 2am Enabled Actions: Start a Program C:\Windows\System32\WindowsPowerShell\V1.0\powershell.exe -ExecutionPolicy Bypass -file "SSRS_Startup.ps1" Settings: Allow task to be run on demand

Have detailed these as they are important, particularly Actions.