Is it possible to restart IIS on an Azure web page without restarting the process?

I have a site running on the Azure web role, and I can force it to restart the application by changing the web.config file, but if I want to restart IIS, I was told that I should not do this manually using Remote Desktop, and instead of this I have to restart the hosting process in Azure.

This article seems to agree with this opinion.

My problem is that restarting the process can take almost 10-15 minutes to restart. Is there a faster way to achieve this?

I am currently using the windows.azure.com user interface for all deployments and management.

+8
iis azure
source share
4 answers

A few things to point out here. When your role begins, it uses something called IISConfigurator to programmatically program in IIS and create applications, vdirs, application pools, etc., as defined in Service Definition. This is done once at startup.

Remember that the w3wp.exe process that hosts your site is completely separate from RoleEntryPoint, which you can use to run the code. This way you cannot just call RoleEntryPoint.RequestRecycle () and expect IIS to restart (it won't).

One solution you can try if you have to restart IIS is to programmatically do this. 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 use the knowledge that application pools are GUIDs in Windows Azure to filter them out to those that interest me.

Now you just need a way to run this code from an elevated state on demand in each instance. This is a common problem with many solutions. Perhaps each instance of a file or table poll for a signal to run this code when you need to restart IIS.

+7
source share

Why do you need to restart the instance? Are you experiencing a memory leak or any other issue in your production deployment? In a production environment, the only truly secure way to restart an instance is through the Azure Management Portal or the Azure Management REST API.

If you are working with a dev / test deployment, you can enable RDP and disconnect your instance using the Set-RoleInstanceStatus PowerShell cmdlet. At this point you can start IISReset, restart the WWW publishing service, change web.config, copy the new dlls to the bin folder and etc. Etc. We all do this with our dev / test examples without a problem, but we never mess with our production instances via RDP unless we need to fix an urgent problem.

+2
source share

If you are deploying your application as a "YourName" application, for example

Azure App Service

from the URL http://yourname.azurewebsites.net you should be able to connect to http://yourname.scm.azurewebsites.net using the same credentials as for managing Azure. At this URL, you will find Kudu for the corresponding application service.

If you select "Tools"> "Support" and then "Analysis"> "Metrics" then you must click "Restart w3wp".

Kudu UI

The time to reuse the application was not unexpectedly long for the three tested applications.

If you only need to "watch" w3wp, then you can check https://youname.scm.azurewebsites.net/ProcessExplorer/

+1
source share

you can try remote desktop for instance and recycle IIS this way

0
source share

All Articles