IIS 7 & IIS 8
IIS 7: InetPub Location
Last post Mar 13, 2013 03:30 PM by firstname.lastname@example.org
Feb 10, 2007 11:34 AM|LINK
This is probably been asked before, but I've looked through the FAQ's, searched and browsed all the forums and couldn't find what I was looking for.
Is there any way at all to customize the default location of the web root with all of its corresponding directories?
IIS 7 (like previous versions) defaults to creating the directories as C:\Inetpub\... I'd like to move these to a different drive. In IIS 6, one could simply edit the metabase. In prior versions, it was even more simple.
I apologize if I'm beating a dead horse, but this is a must-have feature that I was really hoping would be implemented this time around.
Feb 11, 2007 02:41 AM|LINK
Open %windir%\system32\inetsrv\config\applicationhost.config and search for
Change the path.
Or do an %windir%\system32\inetsrv\appcmd list vdir
and to change the path execute
%windir%\system32\inetsrv\appcmd set vdir "Default Web Site/" -physicalPath:<your new path>
Feb 11, 2007 05:24 AM|LINK
Thanks, Thomas, for your quick response! Is there any way to move or change the rest of the directories? For example, I'd like to move the entire Inetpub directory to a different partition and rename a few of the sub-directories inside the Inetpub directory.
(I realize I should have said that from the beginning and I apologize.)
Feb 11, 2007 06:08 AM|LINK
Well, Thomas already told you the way to do it. what you should do is:
a) copy entire inetput or your web files to the new drive/partition, etc
b) then use the command syntax shown above to change it
c) test it and make sure it is working
d) delete the old inetpub/etc at source disk drive.
Feb 11, 2007 10:25 AM|LINK
Thanks for your response, Bernard. I figured out how to adjust the default web site's location. That's configurable via the IIS manager. What I was trying to figure out was how to modify the "default" location of the the Inetpub folder's subdirectories.
Those being "custerr", "logs", "temp", etc.
I found the entries in "applicationHost.config" and imagine I can just edit those entries, but I was wondering: Is there any possibility in the foreseeable future that a snap-in or module might be added to manipulate these via the IIS manager?
Thanks again, for your time.
Feb 12, 2007 04:20 AM|LINK
If your request would be a common ask we would implement this feature in a heartbeat. It's the first time that I hear this request though.
Don't get me wrong, moving the content directory to a different drive (%systemdrive%\inetpub\wwwroot) is a very common request. The reason we don't do it by default is that during IIS setup we can't be sure that there is another partition and that customers
want their content directory there. We can't show UI during setup because customers are even more annoyed about that (i.e. when you go to lunch and kick off an Windows install and expect it to be done when you come back. Instead you see a dialog box that asks
you for a path).
Moving all of inetpub is not very common though. There is an relatively easy way however. You can xcopy %systemdrive%\inetpub\ to a different partition and then open %windir%\system32\inetsrv\applicationhost.config.
Search for all instances of inetpub and replace the path with your new path.
It gets a bit harder with schema defaults. These are config entries that are used when not specified in the configuration file (applicationhost.config). The schema defaults are in %windir%\system32\inetsrv\config\iis_schema.xml.
You can also search for inetpub in there. Changing IIS_SCHEMA.XML won't work because it is system-file protected. You have to make an explicit configuration entry that gets written to applicationhost.config. Here a couple of examples:
How to change the path for the ASP template cache directory default:
%windir%\system32\inetsrv\appcmd set config -section:asp -diskTemplateCacheDirectory:<your new dir>
How to change the default for logfiles:
%windir%\system32\inetsrv\appcmd set config -section:sites -siteDefaults.logfile.directory:<your new directory>
How to change the default for failedRequestLogs:
%windir%\system32\inetsrv\appcmd set config -section:sites -siteDefaults.traceFailedRequestsLogging.directory:<your new directory>
or for the compression cache directory:
%windir%\system32\inetsrv\appcmd set config -section:sites -httpCompression -directory:<your new dir>
Hope this helps.
Feb 12, 2007 05:50 AM|LINK
So using the %systemdrive% installation path does makes sense in the way you've pointed out. I can see how having to ask for the path in the midst of installing windows would be a major headache.
As far as the applicationhost.config goes, I did some more poking around and do see how it works and how easy it is to manipulate it. What I am wondering is, if you add or remove components later on, doesn't this over ride any modifications you've made?
For example, if I dhave the Custom Errors module installed and modify the entry, then reinstall it, won't it overwrite my values with those from the IIS_SCHEMA.XML? If that's the case, I suppose making a backup of a customized version is quite simple, but
I found out that certain modules won't install correctly if the directories aren't there. I can't remember which one it was, but one of them gave me an error because I'd removed its default directory. Restoring the directory made it install OK.
I guess I'd like to see, at some point in the future, a tool like IIS 6's Metabase Explorer that allows for direct manipulation of the applicationhost.config file. I realize that some sections are editable via the IIS Manager and there's add-in tools, like
the Logging UI (that doesn't ship with Vista *snicker*), but some kind full editor would be great.
Thanks for your responses. It's greatly appreciated. And I can't thank you and your team enough for the improvements made to IIS 7.0. I've been using IIS since NT and have been bouncing back and forth between it and Apache. With the extensibility of IIS
7.0, Apache just became obsolete.
Feb 12, 2007 06:21 AM|LINK
thanks for the nice feedback. I don't think we override settings in applicationhost.config with default settings. It's worth a try though. I don't know why you would want metabase explorer? Just open applicationhost.config and you are ready to go. If you
are scared to screw something up you can just make a file backup of applicationhost.config and you simply copy it back if you made a mistake. You can also use %windir%\system32\inetsrv\appcmd add backup <name of your choice> to make a backup.
%windir%\system32\inetsrv\appmcd restore backup <backup name> restores it.
Feb 12, 2007 08:48 AM|LINK
I'll have to test it out. What I'm afraid of is if, say I were to uninstall a module after changing a path, that it will remove that section. And then if that module were reinstalled, the default setting would be written.
I didn't mean Metabase Explorer, persay. Just a tool that would give us a GUI for editing the sections. Sort of like how the IIS Manager does. A snap-in to the IIS Manager for editing that file as part of "power toys" or a "tool kit" would be VERY nice.
For now, I'll stick to manual editing and see how it works. Thanks, again!
Feb 12, 2007 03:53 PM|LINK
Are looking for something like a property editor. I think we have something like this in the pipeline, i.e. Longhorn Server/Vista SP1.