Error Solved - Windows Azure Cannot Perform a VIP Swap

I was taking a look at the Windows Azure VIP swap feature and encountered this issue.

What this issue is all about and what VIP Swap is

I had deployed an application on the production slot of a cloud service and the test application was deployed on the staging slot of the same cloud service.

When you have both deployments of a cloud service up and running, you can do a VIP swap that is nothing but the swap between your virtual IP addresses of production and staging deployments and doing so your production deployment becomes the staging and staging deployment becomes the production deployment.

But then after trying to do a VIP swap I started facing an error that says:

"Windows Azure cannot do a VIP swap between deployments that have a different number of endpoints."

Though the error was too obvious and pointing to the exact issue, still as a typical developer I preferred to do a quick search on the web and this seemed to be a very common issue that is encountered by many people and so I am documenting the possible solutions.

The solution

The solution is quite easy since the error is descriptive enough. Check the number of endpoints of your cloud service deployments.

  • Check the cscfg files of both deployments, in other words production and staging. The number of input endpoints on both deployments should match.

  • Check the endpoint ports of both slot's deployments, for example Https / Http. (443/80).

  • Check if one of your deployments has remote desktop enabled on any of it's role instances because it ultimately ends up opening another port internally on your cloud service. If the remote desktop is enabled then it needs to be enabled on both deployment slot's instances.

Takeaways

Ideally both of your deployments should match exactly because whenever you want to put something on the production slot by swapping it with staging then need to ensure that it works correctly and this is why the staging slot is used for internal testing purposes, however there might some scenarios where you might want to have different deployments on both slots, for example Site under maintenance on the production slot when you upgrade your deployment on staging and test it.

So be sure to have a close look at the endpoints of your both deployments and now you know how.