Introduction
After installing Vista and IIS 7.0 and playing with numerous configuration options, the conclusion was reached that it can only be installed in the \inetpub directory. And there were no posts, KB entries or technical papers on how to accomplish this available. Well, that was not going to work since I don’t like the name inetpub, let alone like being forced to install something the way someone else deems fit, so some time was spent figuring out how to make that possible. The result of that work is this post, and the instructions below are the first guide that could be located on the Internet to accomplish that. May the work done here benefit someone else as well. And sorry about the screen shot quality. It seems to be the best resolution that can be upload here. Hopefully the descriptions are good enough, but if not, there is a Word document that could be sent of if really needed.
Please Read!
The following guide assumes a new IIS 7.0 installation into Vista. If an existing installation already exists, some of the configuration steps outlined below may need to be repeated for other Web Sites that may already exist. HTTP services is assumed to be installed, but instructions for configuring other services are provide as optional (MSMQ, FTP) and are indicated as such. If you don’t have those services running, the step can be safely skipped.
Note: All the modifications below have been tested on multiple virtual and physical machines by myself and have been proven to work on both the Ultimate and Enterprise editions of Vista, but depending on the configuration of Vista, IIS or the machine itself, serious, if not fatal errors may occur to the system. Please backup the system before attempting any part of this configuration. This information is provided as a guide, and I will not be responsible for any damages or harm to persons or systems that utilize this guide.
In a couple of places in the guide, some of the existing paths may include the %SystemDrive% token in the path. If the new directory is also on the system drive (directory where Windows is installed to) the same token could also be used. In the following examples, even though the new directory is on the same drive as the old one, the instructions do not use the %SystemDrive% token, but as stated above, could if desired.
Old and New Configurations
The diagram below show the pre- and post-configuration structure of the new and old directories. The old directory is C:\inetpub and the new directory is C:\Internet Files.
Create New IIS Directories & Move files
1. Create the directory (or directories if for example the logging directory is to be separated from main IIS Root directory) where the IIS Files will be relocated to (the path in the above example is C:\Internet Files).
2. Copy ALL files from C:\inetpub to the new directory (C:\Internet Files) or directories.
3. Create directory for logs if it has not already been created yet and come over as part of the copy process in step 1 (in the example, this directory is (C:\Internet Files\Logs\Log Files).
Move Log File Directories
While the most of the configuration can be done in the IIS 7.0 and 6.0 UIs, the log files cannot. Until Vista SP1 is released, there are two current ways to change the log file directories. An automatic way using a tool found at www.iis.net or a manual approach using the IIS appcmd tool. Steps are given below for both examples.
Note: Using the IIS 7.0 Logging Utilities method will NOT change the path indicated in steps 3-6 of the manual configuration section below (the main one required is changed), even after running the tool. While the rest of the installation can be followed and everything seems to work, having the one reference to the old path may cause the inetpub directory to reappear at a later time and therefore, the manual configuration method is recommended, or running the manual steps 1-6 (then an IIS Reset) after installing and using the automated IIS 7.0 Logging Utilities tool.
Method 1: Automated Using the IIS 7.0 Logging Utilities
Download Logging Utility
The Download the Logging Utility was created by Tobin Titus (blog site here: http://blogs.iis.net/tobintitus) from Microsoft and can be downloaded here: http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1328. Source code is also copied to the machine when installing the utility (but can be safely deleted afterwards, if the machine is a production machine).
At a later time, Vista SP1 should provide this functionality by default. Once it is released, I will update the procedure.
Install Logging Utility
1. Download the ZIP file and extract the MSI.
2. Install the MSI
3. Run notepad as Administrator (do this by right-clicking your notepad shortcut and choosing "Run as Administrator")
4. Open %systemdir%\system32\inetsrv\config\administration.config
5. Find the <moduleProviders> section and add the following element:
<add name="VistaIisLogging" type="Microsoft.Web.Management.Iis.Server.LoggingModuleProvider, IisLoggingServer, Version=1.1.0.0, Culture=neutral, PublicKeyToken=74622615c9245f3f" />
6. Find the <modules> section under the <location path"."> element and add the following element:
<add name="VistaIisLogging" />
7. Save the file and open InetMgr.exe
Set Log Directories
1. Run IIS 7.0 Administration
2. Go to (double-click) “Server logging” item under “Other” in the Features View while at the IIS (top-level) of the management console.
3. In the Actions pane, click on “Site Logging Defaults”
4. Change the log files directory to the new directory (for the example this is C:\Internet Files\Logs\Log Files) and click Apply
5. Repeat the same except this time select the Default Web Site before double-clicking on “Server logging”. Also, you will not need to select “Site Logging Defaults” for the site level items.
6. Repeat as necessary if you have any other existing sites.
7. Restart IIS.
Method 2: Manual Configuration using APPCMD Tool
1. Open a command window by right clicking on the Command Prompt item and selecting “Run as Administrator”.
2. Navigate to the C:\Windows\System32\inetsrv directory.
3. I’ve had the commands fail when cutting and pasting the from the document and highly recommend typing them in
directly to the command prompt to execute.
4. Run the following command: appcmd set config -section:log /centralBinaryLogFile.directory:”C:\Internet Files\Logs\Log Files”
5. The following message should appear: “Applied configuration changes to section "system.applicationHost/log" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST".
6. Run the following command: appcmd set config -section:log /centralW3CLogFile.directory:”C:\Internet Files\Logs\Log Files”
7. The following message should appear: “Applied configuration changes to section "system.applicationHost/log" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST".
8. Run the following command: appcmd set config -section:sites /siteDefaults.logFile.directory:”C:\Internet Files\Logs\Log Files”
9. The following message will appear on successful completion: Applied configuration changes to section "system.applicationHost/sites" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST".
Note: In a later step, the applicationHost file will be edited directly, and these paths will be present. Modifying the following locations WITHOUT using the appcmd utility has sometimes rendered IIS unable to start after manually typing in the paths. After running the appcmd tool, there will sometimes be some binary characters after the paths that the appcmd puts in (†in the diagram below). In an emergency they could be placed back in and IIS may work again, but the best way would be to rerun the above appcmd commands. The following diagram shows the applicationHost file after the modifications (including the binary characters). I’ve seen it both ways, so if they are not there, then it should not be an issue.
10. Restart IIS. If starting IIS fails, then rerun the APPCMD commands above and ensure the success messages are produced. (See note above about typing command by hand).
Additional Configurations
Configure HTTP
1. The following items point to the items that need to be updated by configuring them in IIS to point toward the new paths. The updates are listed below under three categories, Top-Level, Web Sites Level and Default Web Site Level. Top-Level includes all the default IIS adjustments, Web Sites Level is the parent of the Default Web Site Level which includes all the site level adjustments and will need to be configured for each web site if more than one is present. For each level, each item to be configured consists of the required selections necessary for the configuration of the item in this format: IIS -> ASP -> Services -> Caching Properties -> Cache Directory Path, followed by the default setting, followed by the setting for the example explained earlier. Items that exist in the Action Pane that need to be selected are bolded. It is also assumed that the different IIS pages are in “Features View” mode when navigating. For the above example, the Top-Level directory would be selected in the Tree View pane and then under the IIS group of the page the ASP item would be double clicked. On the ASP page, the Services then Caching Properties items would be expanded, and finally the Cache Directory Path would be edited. The screen would look like this before clicking Apply in the Action pane
2. Top Level Adjustments (Root Path in tree pane)
a. Cache Directory Path
PATH: IIS -> ASP -> Services -> Caching Properties -> Cache Directory Path
OLD: %SystemDrive%\inetpub\temp\ASP Compiled Templates
NEW: C:\Internet Files\Temp\ASP Compiled Templates
3. Web Site Adjustments (Web Sites leaf in tree pane)
a. Failed Request Tracing
PATH: Set Web Site Defaults -> Failed Request Tracing -> Directory
OLD: %SystemDrive%\inetpub\logs\FailedReqLogFiles
NEW: C:\Internet Files\Logs\Failed Req Log Files
4. Default Web Site Adjustments (Default Web Site leaf under Web Sites leaf in tree pane). For each additional Web Site present, these items should be changed as well.
a. Physical Path
PATH: Advanced Settings -> (General) -> Physical Path
OLD: %SystemDrive%\inetpub\wwwroot
NEW: C:\Internet Files\WWW Rootb. Failed Request Tracing
PATH: Advanced Settings -> Failed Request Tracing -> Directory
OLD: %SystemDrive%\inetpub\logs\FailedReqLogFiles
NEW: C:\Internet Files\Logs\Failed Req Log Files
c. MSMQ Physical Path (Optional Installation)
PATH: MSMQ -> Advanced Settings -> (General) -> Physical Path
OLD: C:\inetpub\wwwroot\msmq
NEW: C:\Internet Files\WWW Root\MSMQ
5. Close IIS 7.0 Management Console
Configure FTP (Optional Installation)
To configure FTP the IIS 6.0 Console needs to be launched. The directions below show how to change this setting
1. Launch IIS 6.0 Management Console
2. Select FTP Sites -> Default FTP Site
3. Select Default FTP Site (Click once)
4. Right click Default FTP Site and select Properties
5. Select Home Directory tab then update the Home Directory from C:\inetpub\ftproot to C:\Internet Files\FTP Root
6. Click OK and Close IIS 6.0 Management Console
Registry Modifications
1. The following items in the registry need to be edited.
2. Start Registry Editor (Regedit.exe)
3. Navigate to the following keys and change the values as indicated.
4. KEY: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\PathFTPRoot
OLD: %SystemDrive%\inetpub\ftproot
NEW: C:\Internet Files\FTP Root
5. KEY: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\PathWWWRoot
OLD: %SystemDrive%\inetpub\wwwroot
NEW: C:\Internet Files\WWW Root
6. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\WAS\Parameters (only needed if Vista SP1 or later is installed).
ADD: A new REG_SZ (String Value) called ConfigIsolationPath
NEW: – C:\Internet Files\Temp\AppPools
7. Close Registry Editor
ApplicationHost Config Modifications
1. Run Notepad as administrator (right click shortcut and select Run as Administrator)
2. Open applicationHost file (C:\Windows\System32\InetSrv\Config\applicationHost.config – if the file cannot be viewed in the open dialog, it should still be able to be opened by directly typing the file name once in the directory.)
3. Search and Replace the following items:
4. HTTP Compression Directory
OLD: <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
NEW: <httpCompression directory="C:\Internet Files\Temp\IIS Temporary Compressed Files">
5. Custom Error Pages (Replace all instances – nine by default)
OLD: "%SystemDrive%\inetpub\custerr"
NEW: "C:\Internet Files\Custom Error"
6. Below is a screen shot of the edited items in Notepad
7. Save file and exit Notepad (if an access error occurs when saving a file, it usually means notepad was not started in administrator mode, or the file is currently locked by IIS. In the case of the former, reopen notepad in administrator mode and try again, in the case of the latter, stop all IIS services and try saving again).
8. Restart IIS
Delete INETPUB Directory
1. At this point ALL references to inetpub should be pointing to the new directory (C:\Internet Files) and the inetpub directory can be safely deleted.
2. No more inetpub!
Conclusion
Please send any questions, comments, blatantly missed step, or if any of the steps are particularly confusing to me via this blog post. Someday, I may get around to scripting the process, but for now, while they may seem complicated at first, I can do the complete process in less than 10 minutes per machine using the above steps.