Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
Markdown Monster - The Markdown Editor for Windows

Editing Applicationhost.config on 64 bit Win2008


:P
On this page:

Here's an interesting note about Windows 2008 running in 64 bit. Today I needed to edit ApplicationHost.config only to not find the damn file anywhere on my machine. It turns out 64 bit Windows uses redirection in the System32 folder and while running with a 32 bit Explorer replacement and a 32 bit editor I was unable to find the file until I switched to the stock tools in Windows which are 64 bit.

This bit me because I needed to make some changes in applicationhost.config. ApplicationHost.config is IIS 7's master configuration file that holds top level configuration settings. In it you can find things like Application Pool and Virtual directory definitions as well as most of the default root level configuration settings for IIS and ASP.NET.

What I wanted to do is change the IIS GZIP compression settings as well as lock down the UrlScan rules to lock out some unwanted DOS style attacks that seem to be plaguing a lot of sites over the last few days. Anyway I needed to open ApplicationHost.config on my newly buffed up Windows 2008 64 bit Server. And this is where it gets weird.

ApplicationHost.config should live in:

c:\windows\system32\inetsvr\config\applicationhost.config

So I navigated there and found - nothing. An empty folder with no files.

I'm running xPlorer2 as my Windows Explorer replacement interface and I installed it on the server as well to facilitate the lengthy process of copying files onto the new machine from the old Web Server. xPlorer2 rocks and beats the crap out of Windows Explorer (no big feat), but it's 32 bit application. One very nice feature of xPlorer2 is that it also has a quick deep search feature so I fired that off to search the entire boot drive for ApplicationHost.config. However, I came up with only history files and one version in some obscure amd64 related folder (most likely from an install path).

In short the freaking file I'm looking for was nowhere to be found on the system! So I searched around and ran into this IIS forums post that talks about a similar problem:

http://forums.iis.net/p/1150832/1875622.aspx

Basically it turns out that when you are running a 32 bit application you cannot see certain files in the 64 bit system32 folder - ApplcationHost.config among them. Files may be split between the system32 folder and system32Since xPlorer2 is 32 bit I get this (contrasted below with classic Explorer which does show the files):

64Bit32BitNotfound

The top app is xPlorer2 the bottom standard old Explorer. Notice that same folder in xPlorer2 above is empty while in classic Explorer the files show. But the issue is not just that files don't 'list' in a directory listing, but they are literally not accessible to 32 bit applications. The machine also has Visual Studio Tools for Applications installed, which is an editor - installed likely with SQL 2008 and meant for editing configuration files. It's essentially just the VS editor that does syntax highlighting (notice the Visual Studio Icon next to the Open button in the Explorer Window).

But it fails to open ApplicationHost.Config because it's a 32 bit app:

VisualStudioEditingFails64Bit

My favorite editor - EditPad - that is the default text editor in my configuration also doesn't work for the same reason. In the end, the only way I could actually edit ApplicationHost.config is with Notepad... Oh joy <g>.

I mentioned that I'm new to 64 bit, with this installation on the server being the first and this - this is really something I had no idea about. This is whacky to the max and heck it doesn't even make any sense. I did some searching around trying to find more information on this topic and it looks like there's very little info on this issue or at least it's not easy to find (here is one and another). Both of these describe the x64 FileSystem Redirector which basically routes DLL access to 32 bit or 64 bit specific directories. I suspect what's happening is that even other files are being redirected so trying to access applicationhost.config looks in C:\Windows\SysWOW64\inetsrv\Config but even there applicationhost.config is not found because well IIS is a 64 bit app and doesn't look there.

So using a 64 bit Editor and stock Explorer is the only way for the moment to get at the file. Kinda whacky, eh?

Posted in Windows  

The Voices of Reason


 

Nicholas
August 09, 2008

# re: Editing Applicationhost.config on 64 bit Win2008

I can see how that would make anyone crazy. I haven't run into an instance where I had to edit that file though, IIS7's management interface lets you control a lot of that if you know where to look. Were you tweaking the GZIP/etc. settings?

Rick Strahl
August 09, 2008

# re: Editing Applicationhost.config on 64 bit Win2008

@Nicholas - I was editing the GZip content types as well as the requestFiltering options. Neither can be set through the admin UI.

Nicholas
August 09, 2008

# re: Editing Applicationhost.config on 64 bit Win2008

Gotcha. I'm curious as to what additional mime types you specify? I probably need to update mine..

Dan Finch
August 14, 2008

# re: Editing Applicationhost.config on 64 bit Win2008

There's also the "IIS Admin Pack" for IIS7 which installs a configuration editor into the IIS management console. It'll let you edit all of the machine's configuration files with a GUI.

CarlosAg
August 18, 2008

# re: Editing Applicationhost.config on 64 bit Win2008

Have you tried opening %windir%\sysnative\inetsrv\config\ApplicationHost.config ?
SysNative allows 32 bit applications to gain access to native 64 system folder

adrian
August 19, 2008

# re: Editing Applicationhost.config on 64 bit Win2008

before i figured out what happened, i seriously lost confidence in my windows skills (there's not that much to loose with windows itself). i found a microsoft xml notepad (http://www.microsoft.com/downloads/details.aspx?familyid=72d6aa49-787d-4118-ba5f-4f30fe913628) which is in itself .. well .. weird. so the search continues

Patrick
June 28, 2009

# re: Editing Applicationhost.config on 64 bit Win2008

I have ran into so many issues on Vista 64 with VS 2008 and other issues I am thinking about shipping my new laptop back and get Vista 32. The edit issue Rick mentioned was just one.

Erik Anderson
August 11, 2009

# re: Editing Applicationhost.config on 64 bit Win2008

What a coincidence - I just ran into this issue today. I thought I was losing my mind and had to show another co-worker just to make sure I wasn't the one losing it. In my case, I found the default web server wouldn't run due to a malformed applicationHost.config file. It seems some installer, possibly ArcGIS Server 9.3.1, inserted three garbage characters at the start of the file.

For even more strangeness, I could see the garbage characters using "type" or "clip" from the command prompt. But when I opened the file in Notepad they weren't there.

I was able to write over the file but now have to deal with an WAS issue before I can determine if this corrected the original problem.

Wierdness!

Paulo Eduardo Neves
October 21, 2009

# re: Editing Applicationhost.config on 64 bit Win2008

I've found you via Google.

After reading your explanation, here is my solution: copy the file elsewhere, edit it with your favorite editor, and copy it back.

Daniel Bryars
March 10, 2010

# re: Editing Applicationhost.config on 64 bit Win2008

I'm curious about the "unwanted DOS style attacks" you mentioned, makes me think I should be changing my UrlScan rules too?

Can you point me in the right direction to read up about these type attacks please?

Carl
May 03, 2010

# re: Editing Applicationhost.config on 64 bit Win2008

I ran into this one today. Also found that the windows explorer search built into explorer now di d not find the original file, only the backups.



Yeah, just another way that windows is SO helpful.

Jay
July 14, 2010

# re: Editing Applicationhost.config on 64 bit Win2008

a good workaround to the 32-bit redirection is to map a network drive to the local machine, i.e.,

net use X: \\localhost\c$.

the 32-bit app can then access X:\windows\system32\inetsrv\config\applicationhost.config without issue.

Tim
August 17, 2010

# re: Editing Applicationhost.config on 64 bit Win2008

Just open notepad an open the file via drop & drop.

JamezJ
October 12, 2010

# re: Editing Applicationhost.config on 64 bit Win2008

FYI. I got this same error message on Windows 7 (IIS7.5), trying to run an asp.net application.

Tracy Dryden
January 13, 2011

# re: Editing Applicationhost.config on 64 bit Win2008

Get the 64-bit version of Directory Opus (pricey, but worth it) and you'll be able to SEE the file, but you still won't be able to EDIT it. The solution I found, at http://icelava.net/forums/thread/5391.aspx, is to go to the c:\windows\syswow64\inetsrv folder, rename the config folder to config86 (since it's emtpy anyway, it doesn't really hurt) and then create a symbolic link from c:\windows\system32\inetsrv\config to c:\windows\syswow64\inetsrv\config (with Link Shell Extension it's a simple operation). It's a bit bizarre to have to redirect the redirect, but it works like a charm.

DuskoS
February 26, 2011

# re: Editing Applicationhost.config on 64 bit Win2008

I used the same idea as the poster who maps localhost\c$ drive.
I used:
subst i: "C:\Windows\System32\inetsrv\config"
Now I can point my editor to i: drive.
Works for me.

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024