How to use the Appcmd.exe command-line tool to enable and configure HTTP logging and other features in Internet Information Services 7.0
On This PageINTRODUCTIONThe following features cannot be configured by using the Microsoft Internet Information Services (IIS) 7.0 Manager:
MORE INFORMATIONTo enable these features in IIS 7.0, use the Appcmd.exe command-line tool. When you use this tool, you must first enable the feature. Then, you must configure the settings for the feature. When you run the Appcmd.exe tool, settings are updated in the %windir%\System32\Inetsrv\Config\ApplicationHost.config file. The following sections describe how to use the Appcmd.exe tool to enable various HTTP features in IIS 7.0. To determine other IIS attributes and settings that you can change by using the Appcmd.exe tool, view the full schema in the %windir%\System32\Inetsrv\Config\Schema\IIS_schema.xml file. HTTP loggingTo enable logging for HTTP requests, follow these steps:
appcmd set config /section:httpLogging /dontLog:True Additional logging optionsAfter you have enabled logging for HTTP requests, you can set additional logging options. For example, you can set specific information to log. The following command demonstrates how to log only HTTP substatus information for all Web sites:appcmd set config /section:sites -siteDefaults.logFile.logExtFileFlags:HttpSubStatus You can log the following information for the Web site that has an ID value of 1:
appcmd set config /section:sites /[id='1'].logFile.logExtFileFlags:HttpSubStatus,Host,Time,Date HTTP redirectionTo enable HTTP redirection, follow these steps:
appcmd set config /section:httpRedirect/+[wildcard='WildcardHeader',destination='Destination'] Note In this command, WildcardHeader represents the Web page or pages that you want to redirect. Destination represents the destination Web page to which the WildcardHeader value redirects.To disable HTTP redirection, type the following command, and then press ENTER: appcmd set config /section:httpRedirect /enabled:false HTTP response headersTo add an HTTP response header, follow these steps:
appcmd set config /section:httpProtocol /customHeaders.[name='HeaderName']. value:HeaderValue Note In this command, HeaderName represents the name of the HTTP header that you want to edit. HeaderValue represents the value of the HTTP header that you are editing.To view a list of HTTP response headers, type the following command, and then press ENTER: appcmd list config /section:httpProtocol HTTP compressionTo enable HTTP compression, follow these steps:
REFERENCESFor more information about the Appcmd.exe tool, visit the following Microsoft Web site:
http://www.iis.net/default.aspx?tabid=2&subtabid=25&i=954&p=1 (http://www.iis.net/default.aspx?tabid=2&subtabid=25&i=954&p=1) For more information about how to configure HTTP logging in IIS 7.0, visit the following Microsoft Web site:
http://technet2.microsoft.com/WindowsServer/en/library/bcb7fbfa-8f61-42ca-88ca-59123be5f0011033.mspx (http://technet2.microsoft.com/WindowsServer/en/library/bcb7fbfa-8f61-42ca-88ca-59123be5f0011033.mspx) For more information about how to edit a redirect rule in IIS 7.0, visit the following Microsoft Web site:
http://technet2.microsoft.com/windowsserver2008/en/library/c1d20020-8a63-4f3e-a141-38c01a5286831033.mspx (http://technet2.microsoft.com/windowsserver2008/en/library/c1d20020-8a63-4f3e-a141-38c01a5286831033.mspx) For more information about how to configure HTTP response headers in IIS 7.0, visit the following Microsoft Web site:
http://technet2.microsoft.com/WindowsServer/en/library/37283911-0b7f-40ef-9cad-7ba05425e7e71033.mspx (http://technet2.microsoft.com/WindowsServer/en/library/37283911-0b7f-40ef-9cad-7ba05425e7e71033.mspx) For more information about how to configure HTTP compression in IIS 7.0, visit the following Microsoft Web site:
http://technet2.microsoft.com/WindowsServer/en/library/30e64245-ec6b-4c4e-891b-b7249e36c0a01033.mspx (http://technet2.microsoft.com/WindowsServer/en/library/30e64245-ec6b-4c4e-891b-b7249e36c0a01033.mspx)
| Article Translations
|

Back to the top
, type
If you are prompted for an administrator password or for confirmation, type your password, or click Continue.
