loading...

How to: "warm up" an environment using PowerShell and TeamCity

seankilleen profile image Sean Killeen Originally published at seankilleen.com on ・1 min read

Prior to running some tests on a .NET web application, we wanted to send a request to the environment to “warm it up” – so that the initial start of the application pool would be completed before the tests started running.

Solution

  • Select a URL that you can reasonably expect to hit as a smoke test
  • Create a TeamCity build configuration
  • Add a build step to the configuration of type “Powershell Script”
  • Select an in-line script
  • Add the following powershell:
Invoke-WebRequest -Uri http://theURLToHit -UseDefaultCredentials

Now the build step will hit the URI using the build agent’s credentials, and the command will return when the result does (with a 200 after the app pool has started up).

Happy deployments!

Posted on Feb 19 by:

seankilleen profile

Sean Killeen

@seankilleen

A mind at work. Microsoft MVP && Passionate .NET dev lead && Managing Consultant at Excella. Opinions here are mine. Trying to be all the human I can be with the time I have.

Discussion

markdown guide