Concurrent deployment of applications behind the same load balancer


Consider the following scenario:

We have two different VS solutions for WCF Services “SVCA” and “SVCB”. Both services are hosted under the same IIS Site “SVCSITE” as two different Applications and AppPools, so the urls are: and, respectively.

In terms of infrastructure we use Amazon Web Services (AWS). We have a load balancer “LB” and two identical servers “Server1” and “Server2” behind it.

I have a Team City build server with two separate builds for SVCA and SVCB, both setup for Continuous Integration (CI). I also have an additional step to automatically trigger an Octopus Release and Deployment after a successful build.

In Octopus we defined two separate Projects PRJA and PRJB, one for each service. The deployment process looks like this:

-Parent Rolling Deployment Step (runs on Server1 and Server2)
-Remove Server from LB (using AWS API)
-Deploy NuGet package
-Bring back server to the LB

If I deploy each Project separate everything works fine. The problem is when both builds for SVCA and SVCB are taking place concurrently. PRJA and PRJB Deployments will be triggered concurrently as well, and as a result there are confilcts removing/addings Server1 and Server2 to the LB.

Is there a way to synchronize Projects so they happen sequentially, not concurrently?
I guess this is a common scenario. What’s the proper way to handle it?


Thanks for getting in touch. According to your description, the problem seems to happen when you make changes to your LB at the same time. Since this changes are done as part of your deployment process and you said that if you deploy each project separate everything works fine, i’d go with deploying one project at a time from TeamCity.

Now, on TeamCity you have two CI builds for SVCA and SVCB which would get triggered at the same time. What i’d do is setup the builds to run on the same agent. This way the first build that gets to the agent will start, and the second one will have to wait until the first one finishes.

This link shows how to setup builds to run on specific agents:

Let me know if this works for you