IIS Configuration

Internet Information Services (IIS) is a flexible, secure, and manageable Web server from Microsoft for building and delivering dynamic Web applications and services. Proper configuration is crucial for performance, security, and stability.

Core Configuration Concepts

IIS configuration is primarily managed through a hierarchical structure of configuration files, with the main configuration stored in applicationHost.config. This file, located in %WINDIR%\System32\inetsrv\config, contains settings for the entire IIS server.

Web.config Files

You can override or extend server-level settings at the site, application, or directory level using web.config files. These files follow the same schema as applicationHost.config and are inherited down the hierarchy.

Note: Changes made to a web.config file in a specific directory only affect that directory and its subdirectories, unless explicitly overridden by a more specific configuration file.

Configuration Sections

IIS configuration is organized into various sections, each controlling a specific aspect of the Web server. Some common and important sections include:

Key Configuration Areas

1. Sites and Bindings

A site in IIS is a collection of content and resources that are accessible from a unique address. Each site must have at least one binding, which associates it with an IP address, port, and optional host header.

Example: Binding Configuration

<sites>
    <site name="Default Web Site" id="1">
        <bindings>
            <binding protocol="http" bindingInformation="*:80:" />
            <binding protocol="https" bindingInformation="*:443:www.example.com" />
        </bindings>
    </site>
</sites>

2. Application Pools

Application pools isolate Web applications from each other, improving security and stability. Each application pool has its own worker process (w3wp.exe) that runs its applications. Key settings include:

Tip: Running applications under different application pools with distinct identities enhances security by preventing a compromise in one application from affecting others.

3. Request Filtering

Request filtering allows you to control which types of HTTP requests are allowed to reach your Web applications. This is a critical security feature to block potentially malicious requests.

Common settings include:

4. Authentication and Authorization

IIS provides mechanisms to authenticate users and authorize access to resources.

Warning: Ensure that only necessary authentication methods are enabled. For public-facing sites, Anonymous authentication is common, while internal applications might use Windows Authentication.

Managing Configuration

IIS configuration can be managed through:

Example: Using appcmd.exe to set a binding

%systemroot%\system32\inetsrv\appcmd.exe set site "Default Web Site" /bindings:http/*:80:

Best Practices