Windows Azure Load Balanced Endpoint HTTP 302 Error

We run sets of Virtual Machines (VMs) within Windows Azure which run our client facing web applications within IIS.

Each client is hosted on multiple VMs for redundancy and performance reasons and this is accomplished using a Load Balanced endpoint pointed at each of the VMs.

The endpoints were set up using Windows Azure Powershell to allow for specifying a probe protocol, port and path. We chose HTTP as the probe protocol and port 80 as the probe port. For the probe path, we specified /web/ as this is the path to the application within IIS.

The application itself is an ASP.Net MVC 4 web application. Due to this, when the /web/ path is accessed, the server return a HTTP 302 response code before the application loads the default route and the page is server up with a HTTP 200 response code.

This particular configuration has worked flawlessly for us for many months until last night when our systems began reporting that they were not accessible from their usual URLs.

Immediately I loaded up the Windows Azure Management Portal and went to the VMs page to check their status. They were all being reported as running correctly. Secondly, I connected to a couple of them using Remote Desktop to check they were running, which again, they were.

Next, I went to the IIS logs to see if the requests were making it as far as the VM itself. Within the logs, something had changed. Whereas before, the logs contained two lines for a request from the Load Balancer, the initial 302 code, followed by the 200 with the correct routed page. All that was now there were single lines with the 302 code.

Following a bit of head scratching, I began to think the load balancer's behaviour may have changed and tested the theory by deleting and re-creating the load balanced endpoint with the full path to page accessible without being logged into the system.

Sure enough, this generated a 200 response initially and access to the systems was restored!

I'm not sure if this is documented anywhere and it's not easy to find out about the status of the Azure Load Balancer, but it seems it is worth making sure that the probe path on your load balanced endpoint is set to a path which returns a HTTP 200 response code initially.