Microsoft Azure Stack is an extension of Azure—bringing the agility and innovation of cloud computing to your on-premises environment and enabling the only hybrid cloud that allows you to build and deploy hybrid applications anywhere. We bring together the best of the edge and cloud to deliver Azure services anywhere in your environment.

IIS Reset on Windows Azure Web Role

If you are a web developer, you have most probably used the “quick-and-easy” iisreset command to reset a misbehaving IIS host. This trick usually works great on a classic Windows Server VM. However, if you are running your application on Windows Azure, please DO NOT run iisreset.
Well, if you are reading this post, there is a chance that you like going through all our blog posts, which is very cool and we hope you would find useful them while developing your next application on Microsoft Azure. So if you are one of them, I want to say a very big THANK YOU!
But if our blog posts are not your perfect idea of reader’s digest or bedtime reading, you are most likely here because you tried to reset IIS manually on your Microsoft Azure VM and now your website in unreachable. If that’s the case, don’t worry, you still have a quick and easy fix (but promise me, that you won’t run Reset IIS on your Microsoft Azure Web Role in the future).

Why shouldn’t I run IIS Reset on Azure?

When you run IIS Reset, one of the things that happens is that the Windows World Wide Web Publishing Service (W3SVC), the service responsible for connecting clients to your website, is stopped.
In classic Windows Server, the “Startup Type” of W3SVC is Automatic. Thus, the W3SVC service restarts automatically and everything works fine.
On Windows Azure, however, W3SVC is set to “demand start” so that the Windows Azure Agent that runs inside your Web Role can configure W3SVC before starting the role. Unlike IIS in classic Windows Server, an IIS role in Azure is not intended to be always running but instead has its lifecycle controlled by the Azure platform.

If not IIS Reset, then what?

If you are having trouble with your web application hosted on Windows Azure and think the issue might be related to your IIS host, we recommend the following course of action:

Make sure you have more than 1 role instance so that the Azure load balancer can send incoming traffic to healthy instances. You may also want to consider implementing a custom Load Balancer Probe so that the load balancer is able to direct traffic correctly when Azure considers the role healthy but IIS is not working correctly.

As a last resort, if you simply need to get your website back online quickly and want to worry about debugging the problem later then perform a restart of the role or a reboot through the Windows Azure Management Portal instead of iisreset.

However, if you website is still unreachable, I recommend going back to the Azure Management Portal and rebooting your VM by going to the INSTANCES tab under your Cloud Service and hitting Reboot on your web role, like this (if you have more than one role instance, you only need to reboot the instance that you ran “iisreset” on):
Hope this helps!