I have a site running on an Azure web role and I can force restart the application by modifying the web.config but if I want to restart IIS I have been told that I should never do this manually via remote desktop and that instead I should restart the Azure hosted process.
This article seems to agree with this opinion.
My problem is that restarting a process can take nearly 10-15 minutes to restart. Is there a quicker way to achieve this?
I am currently using the windows.azure.com UI to do all deployments and management.
A couple things to point out here. When your role starts, it uses something called the IISConfigurator to call out programmatically to IIS and create apps, vdirs, app pools, etc. as defined in Service Definition. That is done once on startup.
Remember that the w3wp.exe process that hosts your website is completely separate from the RoleEntryPoint that you might use to run code. As such, you cannot just called RoleEntryPoint.RequestRecycle() and expect that IIS will restart (it won’t).
One solution you might try if you must restart IIS is to programmatically do it. Here is my 3 line solution for restarting IIS on Windows Azure:
I am using the knowledge that application pools are GUIDs in Windows Azure to filter them down to the ones I am interested in.
Now, you just need a way to run that code from an elevated condition on demand across each instance. That is a common problem with lots of solutions. Perhaps have each instance poll a file or table for a signal to run that code whenever you need to restart IIS.