3

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?

Community
  • 1
  • 1
BrettRobi
  • 3,793
  • 7
  • 40
  • 64

2 Answers2

1

The commands to change the startMode and set the site autostart is

set site "$(siteName)" -serverAutoStart:true
set apppool "$(applicationPoolName)" -startMode:AlwaysRunning
Anthony Brenelière
  • 60,646
  • 14
  • 46
  • 58
0

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.

BilalAlam
  • 1,227
  • 9
  • 7
  • 1
    BilalAlam, I do not see a setting in the UI called "Start Automatically". Neither under the "Set Application Pool Defaults" nor under "Advanced Settings" of a specific app pool. I do see the "Start Mode" setting in both places however. I'm running Server 2012 R2. What am I missing? – BrettRobi May 16 '14 at 18:41
  • You are correct. For some reason the "Start Automatically" does not appear in the 2012R2 UI but does appear in prior versions. Sorry for the misinformation and I'm having my team figure out why this change was made. For your case, you can also verify that the setting was made by checking with %windir%\system32\inetsrv\config\applicationhost.config. Look for serverAutoStart. But my original ask still applies -> ensure you have the setting set correctly for the application pool in question and not just for the defaults. – BilalAlam May 16 '14 at 19:52
  • BilalAlam, in the IISMgr UI I do see that my specific app pool took on the default I applied and has a StartMode of AlwaysRunning. When I look in the applicationHost.config file I found a single reference to autoStart and it is set to true, but is in the tag. How do I apply it to my app pool when Azure assigned the app pool guid at deploy-time? – BrettRobi May 19 '14 at 19:49
  • This means that it is the default value for all newly created app pools so whenever Azure has to create a new app pool (usually when you deploy) it will apply the default settings. – Michael Ulmann Nov 20 '14 at 10:37