问题
I really want to enable these IIS settings in a startup script. An answer for doing this in code exists here: AutoStart a WCF on Azure WebRole. I dislike putting that sort of IIS tweaking in code. So I found these commands:
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.autoStart:true
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.startMode:AlwaysRunning
They appear to be exactly what I want logically but do not have the desired affect. I'm deploying a WCF RESTful service via ASP.NET. When remoting into my Azure CloudService instances I can see in IISMgr that StartMode is set to AlwaysRunning, but I don't know where in the IIS UI to find the AutoStart setting.
Can anyone familiar with IIS and scripting chime in on what I might be doing wrong?
回答1:
To answer your question about where to find the autoStart setting in IIS UI, since you are setting the default, you can find it here in the UI:
1) Select "application pools" on left side view.
2) In actions pane on the right select "Set Application Pool Defaults"
3) Look for "Start Automatically". That is the setting for "autoStart".
4) Ensure your setting is correct.
Another thing to consider however, is you just set the defaults. You need to ensure that the specific application pool your application is running in, is set correctly. You can verify that by selecting the specific application pool and then choose "Advance Settings" and once again verify your settings are correctly set. If they are NOT set correctly, consider changing your script to specify the application pool in question.
来源:https://stackoverflow.com/questions/23697215/enabling-iis-autostart-and-startmode-through-scripting