简体   繁体   中英

IIS applicationHost.config changes not reflecting

I've created a test website to make use of the warm-up module provided by the Application Initialization Module .

I've used ScottGu's Blog as well as Wade Hilmo's Blog .

I've installed the module and implemented the changes to the applicationHost.config file and restarted the server:

<applicationPools>
    <add name="MySite" autoStart="true" startMode="AlwaysRunning" managedRuntimeVersion="v4.0" />
</applicationPools>

<sites>
    <site name="MySite" id="4" serverAutoStart="true">
        <application path="/" applicationPool="MySite" preloadEnabled="true">
            <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\MySite" />
        </application>
    </site>
</sites>

Once the server restarts, I check Task Manager and my site's not running. So then deleted the changes and used AppCmd to do it from the Command Prompt:

%windir%\System32\inetsrv\appcmd set apppool "MySite" /autoStart:true
%windir%\System32\inetsrv\appcmd set apppool "MySite" /startMode:AlwaysRunning
%windir%\System32\inetsrv\appcmd set app "MySite/" /preloadEnabled:true
%windir%\System32\inetsrv\appcmd stop apppool "MySite"
%windir%\System32\inetsrv\appcmd start apppool "MySite"

And Bobs your uncle it works perfectly. I then restarted the server for good measure and checked the applicationHost.config file again and the changes I've made are not there; yet the site is running fine in Task Manager and if I access the site it's available immediately. Stopping and starting the app pool sees the site immediately pop up in Task Manager.

So my question is, where are the settings being stored if not in the applicationHost.config file?!

Edit: I've done a lot of digging and playing but am no closer to an answer. Firstly, after some searching I found out there's another applicationHost.config file. The one I've been editing sits in

%windir%\System32\inetsrv\config\applicationHost.config

The second is apparently something to do with 32bit but the first applicationHost.config clearly shows the 32bit web sites. Even so, the second one didn't reflect my changes either

%windir%\\SysWOW64\\inetsrv\\config\\applicationHost.config

I did a search for applicationHost.config it found a few other copies of it but seems more like those are initial / backup copies of them.

I then created a second website, the two sites are now configured as such:

<applicationPools>
    <add name="MySite" autoStart="true" startMode="AlwaysRunning" managedRuntimeVersion="v4.0" />
    <add name="MySite2" autoStart="true" startMode="OnDemand" managedRuntimeVersion="v4.0" />
</applicationPools>

<sites>
    <site name="MySite" id="1" serverAutoStart="true">
        <application path="/" applicationPool="MySite" preloadEnabled="true">
            <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\MySite" />
        </application>
    </site>
    <site name="MySite2" id="2" serverAutoStart="true">
        <application path="/" applicationPool="MySite" preloadEnabled="false">
            <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\MySite" />
        </application>
    </site>
</sites>

First site should autostart and second site should be on demand.

I then ran the following AppCmd commands:

%windir%\System32\inetsrv\appcmd set apppool "MySite" /startMode:OnDemand
%windir%\System32\inetsrv\appcmd set app "MySite/" /preloadEnabled:false

%windir%\System32\inetsrv\appcmd set apppool "MySite2" /startMode:AlwaysRunning
%windir%\System32\inetsrv\appcmd set app "MySite2/" /preloadEnabled:true

to configure them the opposite way round to how they're configured in the applicationHost.config. I Restarted the server completely and checked the config, it's still as I originally left it and not reflecting the changes and neither site is starting.

I then changed the config of site 2 to autostart (as for site 1) and restarted the server but it still didn't start. I then ran:

%windir%\System32\inetsrv\appcmd set apppool "MySite2" /startMode:AlwaysRunning
%windir%\System32\inetsrv\appcmd set app "MySite2/" /preloadEnabled:true
%windir%\System32\inetsrv\appcmd stop apppool "MySite2"
%windir%\System32\inetsrv\appcmd start apppool "MySite2"

and it started, restarted server and it started up, though site 1 is still not starting on startup. So I ran:

%windir%\System32\inetsrv\appcmd set apppool "MySite" /startMode:AlwaysRunning
%windir%\System32\inetsrv\appcmd set app "MySite/" /preloadEnabled:true

and restarted the entire server again just for good measure and both sites are starting.

Are you using notepad++ to make these changes and to view the file? If so, use standard notepad that comes with Windows (or notepad2 if you've replaced notepad with notepad2). I guess notepad++ writes only to the 32 bit one by default (according to http://forums.iis.net/t/1151982.aspx?Opening+applicationHost+config+in+anything+other+than+Notepad ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM