Web role in Windows Azure and iisreset side effects

I noticed that when you RDP for an instance of a web role in Windows Azure to do iisreset , the World Wide Web Publishing Service terminates and the only way to get your role back over and over is to either restart the above service or restart / restart your instance.

For reasons unknown to me, Windows Azure by default starts a mode from the World Wide Web Publishing Service to Manual , why the iisreset sorting leaves your web role inaccessible to the WWW.

I found a solution to this - IMO - odd behavior and answered the original question of this post.

However, is there an alternative to iisreset for Windows Azure - perhaps programmatically, where can I pinpoint a specific instance? Because this is another problem; now I have to use RDP for each instance .. it would be nice if it was possible to draw the exact output of each instance.

Think about it; I have a CNAME at www.awesome-azure.com; this is hosted by 3 instances in round-robin, and I want to reset / monitor / diagnose / heartbeat each of them via the REST API (similar), and not now through RDP.

Is it possible to do this.

EDIT

I tried to make it more clear what the problem was, as well as the goal of achievement.

EDIT 2

Providing a solution to the iisreset task; updated the question to identify instances over the Internet, if possible.

+4
source share
3 answers

Well, I still don't know why Microsoft Azure decides to set the World Wide Web Publishing Service to Manual startup mode, but I found a way to change it.

In the second part of the original question, I still hope for an answer, but until then, please find my solution for the first part to fix the iisreset problem (IMO) using the launch task:

In startup.cmd (or whatever you called it), which I placed in the startup folder in the root of my application, include this line of text:

powershell -ExecutionPolicy Unrestricted. \ startup \ w3svc.ps1

In the same folder, create a PowerShell file named w3svc.ps1 with the following contents:

Set-ItemProperty -Path HKLM: \ SYSTEM \ CurrentControlSet \ Services \ W3SVC -Name Start -Value 2

Voila; your IIS is now working as expected - the World Wide Web Publishing Service now set to run in Automatically startup mode.

Note: to work above, you must have the osFamily property of 2 in the ServiceConfiguration.cscfg file .

+4
source

You can handle the RoleEnvironment.Changing event in WebRole.cs and set the Cancel property of the argument objects property to true. Then you just need to make changes to your configuration settings, and Azure will restart all your instances in an orderly manner.

+1
source

I do not know why iisreset not working. As for the second question, you can use the service management API to reboot or re-instantiate the instance. It can do what you want. You can also, of course, write your own code to do whatever you want. (You may have code in your web role that polls a blob called <instance ID>.txt and will be iisreset anytime the blob changes.)

+1
source

Source: https://habr.com/ru/post/1436324/


All Articles