Directly editing IIS 7 applicationHost.config configuration file

35,646

Solution 1

Also check this answer from here: Cannot manually edit applicationhost.config

The answer is simple, if not that obvious: win2008 is 64bit, notepad++ is 32bit. When you navigate to Windows\System32\inetsrv\config using explorer you are using a 64bit program to find the file. When you open the file using using notepad++ you are trying to open it using a 32bit program. The confusion occurs because, rather than telling you that this is what you are doing, windows allows you to open the file but when you save it the file's path is transparently mapped to Windows\SysWOW64\inetsrv\Config.

So in practice what happens is you open applicationhost.config using notepad++, make a change, save the file; but rather than overwriting the original you are saving a 32bit copy of it in Windows\SysWOW64\inetsrv\Config, therefore you are not making changes to the version that is actually used by IIS. If you navigate to the Windows\SysWOW64\inetsrv\Config you will find the file you just saved.

How to get around this? Simple - use a 64bit text editor, such as the normal notepad that ships with windows.

Solution 2

Specifically, is it safe to carefully edit this file instead of using IIS Manager or the appcmd command line utility?

Yes! You can edit the applicationhost.config file directly if you're an Administrator on the machine; that's all that the Admin tools do, too.

If you get into trouble, at least 20 minutes of configuration backups are stored in \inetpub\history by default.

Solution 3

You will find a nice introduction to the applicationHost.config file right over at IIS.NET. There's also a thorough Reference for all elements in the IIS config schema.

It's pretty well-documented actually :-)

Share:
35,646

Related videos on Youtube

lunadesign
Author by

lunadesign

Updated on September 18, 2022

Comments

  • lunadesign
    lunadesign over 1 year

    I know that IIS 7+ uses XML config files instead of the metabase. I also know that if I edit a web.config file for a given site, IIS automagically detects the changes and implements any corresponding config changes.

    However, does this also apply to the server-level applicationHost.config settings file? (usually located in C:\windows\system32\inetsrv\config) Specifically, is it safe to edit this file instead of using IIS Manager or the appcmd command line utility? I couldn't find anything in the documentation that said it was okay or not okay to do this.

    I'm curious because I need to change the bindings for numerous sites from one IP to another. It would be much faster to do a global search and replace the IP address in the config file instead of manually editing a few dozen sites in the GUI.

  • lunadesign
    lunadesign over 12 years
    Thanks! I don't know why they don't document this more.
  • brettwgreen
    brettwgreen about 9 years
    Saved my bacon with this one... what a weird issue that was making me think I was going insane. Thanks!
  • fatDuo
    fatDuo almost 8 years
    According to stackoverflow.com/questions/8635884/… and the comments a full reboot is needed.
  • Dzyann
    Dzyann over 7 years
    This doesn´t seem to be an issue anymore in Windows 10, so it was terribly confusing when it was happening in our Windows 7 and Windows Server 2012 machines.
  • Moby's Stunt Double
    Moby's Stunt Double about 6 years
    Thanks, @Markive. This is a very confusing issue at first glance.