Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Overview
The <system.webServer> element specifies the root element for many of the site-level and application-level configuration settings for Internet Information Services (IIS) 7 in the ApplicationHost.config file, and contains configuration elements that define the settings used by the Web server engine and modules.
Note
Unlike settings that are found in <system.applicationHost>, settings in the <system.webServer> element can be delegated.
Compatibility
| Version | Notes | 
|---|---|
| IIS 10.0 | The <applicationInitialization>element was not modified in IIS 10.0. | 
| IIS 8.5 | The <system.webServer>element was not modified in IIS 8.5. | 
| IIS 8.0 | The <applicationInitialization>and<webSocket>elements were added as child elements. | 
| IIS 7.5 | The <system.webServer>element was not modified in IIS 7.5. | 
| IIS 7.0 | The <system.webServer>element was introduced in IIS 7.0. | 
| IIS 6.0 | N/A | 
Setup
The <system.webServer> element is included in the default installation of IIS 7.
How To
There are no examples that are specific to the <system.webServer> element. For examples that configure the settings that are found within the <system.webServer> element, see the child elements that are listed in the configuration details section of this topic.
Configuration
The <system.webServer> element is defined in the ApplicationHost.config file, although settings in <system.webServer> element can be delegated to Web.config files.
Attributes
None.
Child Elements
| Element | Description | 
|---|---|
| applicationInitialization | Optional element. Configures settings for application initialization that is performed proactively before a request is received. | 
| asp | Optional element. Configures settings for Active Server Pages (ASP) applications. | 
| caching | Optional element. Configures output cache settings. | 
| cgi | Optional element. Configures default settings for Common Gateway Interface (CGI) applications. | 
| defaultDocument | Optional element. Configures settings for returning a default document to a client browser when the client does not specify a file name in a request. | 
| directoryBrowse | Optional element. Configures whether directory browsing is enabled or disabled on the Web server, and specifies the information to include in a directory listing. | 
| fastCgi | Optional element. Contains a collection of fastCgi application pool definitions. | 
| globalModules | Optional element. Specifies configuration settings for global modules on a Web server. | 
| handlers | Optional element. Specifies handlers to process requests made to sites and applications. | 
| httpCompression | Optional element. Configures HTTP compression settings for a Web server. | 
| httpErrors | Optional element. Configures HTTP error messages for a Web server. | 
| httpLogging | Optional element. Specifies configuration settings for HTTP.sys logging. | 
| httpProtocol | Optional element. Configures custom and redirect response headers to be sent from the server to the client. | 
| httpRedirect | Optional element. Configures settings for redirecting client requests to a new location. | 
| httpTracing | Optional element. Specifies configuration settings for HTTP.sys tracing. | 
| isapiFilters | Optional element. Specifies configuration settings for ISAPI filters on a Web server. | 
| management | Optional element. Configures a Web server for remote management by using IIS Manager. | 
| modules | Optional element. Specifies configuration settings for modules on a Web server. | 
| odbcLogging | Optional element. Configures Open Database Connectivity (ODBC) logging. | 
| security | Optional element. Specifies the section group that contains security-related sections. | 
| serverRuntime | Optional element. Configures request limits for applications on a Web server. | 
| serverSideInclude | Optional element. Specifies whether server-side includes (SSI) #exec directives are disabled. | 
| staticContent | Optional element. Configures static file request handler settings. | 
| tracing | Optional element. Configures request trace settings. | 
| urlCompression | Optional element. Configures compression of static and dynamic content. | 
| validation | Optional element. Configures IIS 7 to detect whether an ASP.NET application that is set up to run in ISAPI mode needs any migration in order to function correctly in Integrated mode. | 
| webdav | Optional element. Configures WebDAV publishing settings. | 
| webSocket | Optional element. Configures communications over the WebSocket protocol. | 
Configuration Sample
The following configuration sample defines a simple, static-content-only <system.webServer> element.
<system.webServer>
   <asp />
   <caching enabled="true" enableKernelCache="true" />
   <cgi />
   <defaultDocument enabled="true">
      <files>
         <add value="Default.htm" />
         <add value="Index.htm" />
         <add value="Index.html" />
      </files>
   </defaultDocument>
   <directoryBrowse enabled="false" />
   <fastCgi />
   <globalModules>
      <add name="UriCacheModule" image="%windir%\System32\inetsrv\cachuri.dll" />
      <add name="FileCacheModule" image="%windir%\System32\inetsrv\cachfile.dll" />
      <add name="TokenCacheModule" image="%windir%\System32\inetsrv\cachtokn.dll" />
      <add name="HttpCacheModule" image="%windir%\System32\inetsrv\cachhttp.dll" />
      <add name="StaticCompressionModule" image="%windir%\System32\inetsrv\compstat.dll" />
      <add name="DefaultDocumentModule" image="%windir%\System32\inetsrv\defdoc.dll" />
      <add name="DirectoryListingModule" image="%windir%\System32\inetsrv\dirlist.dll" />
      <add name="ProtocolSupportModule" image="%windir%\System32\inetsrv\protsup.dll" />
      <add name="StaticFileModule" image="%windir%\System32\inetsrv\static.dll" />
      <add name="AnonymousAuthenticationModule" image="%windir%\System32\inetsrv\authanon.dll" />
      <add name="RequestFilteringModule" image="%windir%\System32\inetsrv\modrqflt.dll" />
      <add name="CustomErrorModule" image="%windir%\System32\inetsrv\custerr.dll" />
      <add name="HttpLoggingModule" image="%windir%\System32\inetsrv\loghttp.dll" />
      <add name="RequestMonitorModule" image="%windir%\System32\inetsrv\iisreqs.dll" />
   </globalModules>
   <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
      <staticTypes>
         <add mimeType="text/*" enabled="true" />
         <add mimeType="message/*" enabled="true" />
         <add mimeType="application/javascript" enabled="true" />
         <add mimeType="*/*" enabled="false" />
      </staticTypes>
   </httpCompression>
   <httpErrors>
      <error statusCode="401" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="401.htm" />
      <error statusCode="403" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="403.htm" />
      <error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="404.htm" />
      <error statusCode="405" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="405.htm" />
      <error statusCode="406" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="406.htm" />
      <error statusCode="412" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="412.htm" />
      <error statusCode="500" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="500.htm" />
      <error statusCode="501" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="501.htm" />
      <error statusCode="502" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="502.htm" />
   </httpErrors>
   <httpLogging dontLog="false" />
   <httpProtocol />
   <httpRedirect />
   <httpTracing />
   <isapiFilters />
   <odbcLogging />
   <security>
      <access sslFlags="None" />
      <applicationDependencies />
      <authentication>
         <anonymousAuthentication enabled="true" userName="IUSR" />
         <basicAuthentication />
         <clientCertificateMappingAuthentication />
         <digestAuthentication />
         <iisClientCertificateMappingAuthentication />
         <windowsAuthentication />
      </authentication>
      <authorization />
      <ipSecurity />
      <isapiCgiRestriction notListedIsapisAllowed="false" notListedCgisAllowed="false">
         <clear />
      </isapiCgiRestriction>
      <requestFiltering>
         <fileExtensions allowUnlisted="true" applyToWebDAV="true" />
         <verbs allowUnlisted="true" applyToWebDAV="true" />
         <hiddenSegments applyToWebDAV="true">
            <add segment="Web.config" />
         </hiddenSegments>
      </requestFiltering>
   </security>
   <serverRuntime />
   <serverSideInclude />
   <staticContent lockAttributes="isDocFooterFileName">
      <mimeMap fileExtension=".png" mimeType="image/gif" />
      <mimeMap fileExtension=".htm" mimeType="text/html" />
      <mimeMap fileExtension=".html" mimeType="text/html" />
      <mimeMap fileExtension=".jpeg" mimeType="image/jpeg" />
      <mimeMap fileExtension=".png" mimeType="image/jpeg" />
      <mimeMap fileExtension=".js" mimeType="application/x-javascript" />
      <mimeMap fileExtension=".png" mimeType="image/png" />
      <mimeMap fileExtension=".txt" mimeType="text/plain" />
   </staticContent>
   <tracing>
      <traceFailedRequests />
      <traceProviderDefinitions />
   </tracing>
   <urlCompression />
   <validation />
   <webSocket />
</system.webServer>
Sample Code
There are no code samples that are specific to the <system.webServer> element. For code samples that configure the settings that are found within the <system.webServer> element, see the child elements that are listed in the configuration details section of this topic.