Warm up the Web application and SQL Server Reporting Services on Windows Server

Let me share the way of warming up the web application and also SSRS with the help of VB script running from the scheduled task. This will keep the applications alive and avoid the problem of long delays on the first hit after some period of inactivity.

The VB script presented below sends the GET request to the designated URL using the ServerXMLHTTP object. We can pass the username and password to authenticate the request for reporting services.

Dim strURL
Set webObj = CreateObject("MSXML2.ServerXMLHTTP")
' Replace below URL with the URL of your report in the reporting server
' Replace below Username and Password with your credentials
strURL = "http://MyReportServer/Reports/Pages/Report.aspx?ItemPath=MyReport"
webObj.Open "GET", strURL, False, "Username", "Password" 
webObj.send
' For debugging - uncomment the line below to check the response status
' MsgBox(webObj.Status)

' Replace below URL with the URL of your web application
strURL = "https://myapplication.com"
webObj.Open "GET", strURL 
webObj.send
' For debugging - uncomment the line below to check the response status
' MsgBox(webObj.Status)

Set webObj = Nothing

Save the script as text file with .vbs extension. Then we can test it from cmd by using the command below.
wscript C:\warm-up-script.vbs
To make this script running periodically, let's say every 15 minutes, create the scheduled task. See the screenshots below.





That's it!

Comments

  1. Is there a way to encrypt the password rather than hard coding it?

    ReplyDelete
    Replies
    1. Hi Carl,

      I am not sure if that's possible using the described way. The idea was to create a dummy user account with the only acess to some dummy report. So those credentials would be useless for anybody but to warm up the reporting server.

      Delete
  2. This comment has been removed by a blog administrator.

    ReplyDelete

Post a Comment