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:
var mgr = new ServerManager();
var azurePools = mgr.ApplicationPools.Where(p => Guid.TryParse(p.Name));
azurePools.ToList().ForEach(p => p.Recycle());
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.
+1 This is good to know. In our case, we don't have any code that runs in the RoleEntryPoint. That's why restarting IIS works for us. Would you recommend running the above code in a production instance?
how is this solution ANY different to iis-reset, or RDP'ing and restarting the IIS processes manually? this just does it through code. if the article you link to is true, then this will make no difference at all. will it?
If you know that you occasionally need to reset IIS in response to normal application updates (e.g modifying CRM themes, etc.), you typically want an automated solution. Otherwise, no, it is not altogether different. RDP is great for troubleshooting, not so hot for longterm operations mgmt.
@jmac - it depends a bit on how you implement it. A non-trivial implementation would roll through each instance, have it report itself busy to the load balancer, then run this code to restart (and then report back as ready). That way you keep some instances available as you upate. If you just shotgun the command to each instance, you will likely have a brief period while each IIS app pool recycles until it can serve again.