DEV Community

Sean Killeen
Sean Killeen

Posted on • Originally published at seankilleen.com on

2 2

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

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

Enter fullscreen mode Exit fullscreen mode

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!

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (1)

Collapse
 
ameliaperez profile image
AmeliaPerez

How do I run a PowerShell script in TeamCity? अघोरी बाबा का मोबाइल नंबर

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay