Skip to content

Commit 04fd8ca

Browse files
authored
Merge pull request #53983 from MicrosoftDocs/NEW-internet-information-services-websites-applications
New internet information services websites applications module
2 parents 7a8084c + fb192d4 commit 04fd8ca

16 files changed

Lines changed: 776 additions & 0 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.devrel.website-application-virtual-directory.website-application-virtual-directory
3+
title: Websites, applications, and virtual directories
4+
metadata:
5+
title: Websites, Applications, and Virtual Directories
6+
description: Understand the concepts of websites, applications, and virtual directories in Internet Information Services (IIS) on Windows Server, and learn how to create and configure them to host web content effectively.
7+
ms.date: 03/26/2026
8+
author: Orin-Thomas
9+
ms.author: orthomas
10+
ms.topic: unit
11+
durationInMinutes: 11
12+
content: |
13+
[!include[](includes/1-website-application-virtual-directory.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.devrel.website-application-virtual-directory.application-pool-worker-process
3+
title: Application pools and worker process
4+
metadata:
5+
title: Application Pools and Worker Process
6+
description: Learn about application pools and worker processes in Internet Information Services (IIS) on Windows Server, including how to create and manage application pools to provide process isolation for web applications, and how to monitor and troubleshoot worker processes for optimal performance and reliability.
7+
ms.date: 03/26/2026
8+
author: Orin-Thomas
9+
ms.author: orthomas
10+
ms.topic: unit
11+
durationInMinutes: 14
12+
content: |
13+
[!include[](includes/2-application-pool-worker-process.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.devrel.website-application-virtual-directory.binding-host-header
3+
title: Bindings and host headers
4+
metadata:
5+
title: Bindings and Host Headers
6+
description: Learn about site bindings and host headers in Internet Information Services (IIS) on Windows Server, including how to configure site bindings to host multiple websites on a single server using host headers and Server Name Indication (SNI) for HTTPS sites, and how to manage and troubleshoot common binding issues for optimal website accessibility and performance.
7+
ms.date: 03/26/2026
8+
author: Orin-Thomas
9+
ms.author: orthomas
10+
ms.topic: unit
11+
durationInMinutes: 11
12+
content: |
13+
[!include[](includes/3-binding-host-header.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.devrel.website-application-virtual-directory.advanced-site-configuration
3+
title: Advanced site configuration
4+
metadata:
5+
title: Advanced Site Configuration
6+
description: Learn about advanced site configuration options in Internet Information Services (IIS) on Windows Server, including how to configure custom error pages, MIME types, compression, and request filtering to optimize website performance, security, and user experience.
7+
ms.date: 03/26/2026
8+
author: Orin-Thomas
9+
ms.author: orthomas
10+
ms.topic: unit
11+
durationInMinutes: 12
12+
content: |
13+
[!include[](includes/4-advanced-site-configuration.md)]
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.devrel.website-application-virtual-directory.knowledge-check
3+
title: Knowledge check
4+
metadata:
5+
title: Knowledge Check
6+
description: Check your knowledge
7+
ms.date: 03/26/2026
8+
author: Orin-Thomas
9+
ms.author: orthomas
10+
ms.topic: unit
11+
durationInMinutes: 7
12+
quiz:
13+
questions:
14+
- content: "You have an IIS server with one IP address and need to host three different HTTP websites that must all use TCP port 80. What is the recommended way to ensure IIS sends each request to the correct website?"
15+
choices:
16+
- content: "Assign a separate IP address to each site."
17+
isCorrect: false
18+
explanation: "This works, but it's an older/scarcer-resource approach and not the recommended standard when host names are available. IIS can already distinguish sites using bindings without requiring extra IPs."
19+
- content: "Configure each site to listen on a unique port (80, 8080, 8081)."
20+
isCorrect: false
21+
explanation: "Using different ports can differentiate sites, but it's typically a dev/test or niche scenario because it forces nonstandard ports in URLs and client access. It's not the usual production recommendation when name-based hosting is possible."
22+
- content: "Use host headers (host names) to differentiate the sites."
23+
isCorrect: true
24+
explanation: "IIS routes requests using the binding tuple: IP address + port + host name (Host header). With one IP and port 80, the host name is the differentiator, making host headers the standard production approach (with DNS pointing hostnames to the server)."
25+
- content: "Install a separate instance of IIS for each site."
26+
isCorrect: false
27+
explanation: "IIS is designed to host multiple sites within one instance using bindings; installing multiple IIS instances is unnecessary and doesn't address request routing the way bindings do."
28+
- content: "You need to host two HTTPS websites on the same IIS server using the same IP address and TCP port 443, and each site must use a different SSL/TLS certificate. Which IIS capability enables this?"
29+
choices:
30+
- content: "URL Rewrite."
31+
isCorrect: false
32+
explanation: "URL Rewrite applies after the request is received and processed at the HTTP layer; it doesn't help IIS choose the correct certificate during the TLS handshake."
33+
- content: "IP and Domain Restrictions."
34+
isCorrect: false
35+
explanation: "This feature controls who may access a site (by client IP/domain). It doesn't control certificate selection or enable multiple certs on the same IP:443."
36+
- content: "Server Name Indication (SNI)."
37+
isCorrect: true
38+
explanation: "SNI is a TLS extension that includes the hostname during SSL/TLS negotiation, allowing IIS to select the right certificate even when multiple sites share the same IP and port 443."
39+
- content: "HTTP/2."
40+
isCorrect: false
41+
explanation: "HTTP/2 is a transport/application protocol enhancement; it doesn't enable multiple certificates on a single IP:443. Certificate selection happens earlier, during TLS negotiation."
42+
- content: "A user gets HTTP 404.3 when requesting a .webp image from your IIS website, even though the file exists in the correct folder. What is the most likely cause and fix?"
43+
choices:
44+
- content: "The application pool is stopped; start the application pool."
45+
isCorrect: false
46+
explanation: "A stopped app pool is more associated with application availability issues (often 503). Here, the clue is 404.3, which indicates IIS refuses to serve the file due to extension handling/MIME mapping, not that the worker process is down."
47+
- content: "The .webp extension isn't registered as a MIME type; add image/webp for .webp."
48+
isCorrect: true
49+
explanation: "IIS won't serve certain static file types unless they're mapped under staticContent / MIME types. Adding a MIME map for .webp to image/webp resolves the 404.3 extension configuration issue."
50+
- content: "The file has incorrect NTFS permissions; grant read access to the app pool identity."
51+
isCorrect: false
52+
explanation: "Bad NTFS permissions commonly produce 401/403-style access problems. With 404.3, IIS is indicating an extension/MIME mapping configuration issue rather than a filesystem authorization issue."
53+
- content: "Directory browsing is disabled; enable directory browsing."
54+
isCorrect: false
55+
explanation: "Directory browsing affects listing folder contents when no default document is present. It doesn't fix serving a specific static file when IIS is refusing the file type due to missing MIME mapping."
56+
- content: "You want IIS to block clients from downloading any .bak files from your website (to avoid accidental exposure of backups). Which IIS feature should you configure?"
57+
choices:
58+
- content: "Authentication."
59+
isCorrect: false
60+
explanation: "Authentication controls how users prove identity (Windows/Basic/etc.). It doesn't specifically block a file type from being requested at all."
61+
- content: "URL Rewrite."
62+
isCorrect: false
63+
explanation: "URL Rewrite can redirect/transform URLs, but the built-in security mechanism intended to deny by extension is Request Filtering, which runs early and is purpose-built for this."
64+
- content: "Request Filtering."
65+
isCorrect: true
66+
explanation: "Request Filtering can deny specific file extensions (like .bak). When blocked by file extension, IIS logs/returns the 404.7 substatus for file name extension denied, which is exactly the protective behavior you want."
67+
- content: "Authorization Rules."
68+
isCorrect: false
69+
explanation: "Authorization determines who is allowed to access content (users/roles), not whether a file extension is categorically blocked. Extension-level denial is handled by Request Filtering."
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.devrel.website-application-virtual-directory.summary
3+
title: Summary
4+
metadata:
5+
title: Summary
6+
description: Module summary
7+
ms.date: 03/26/2026
8+
author: Orin-Thomas
9+
ms.author: orthomas
10+
ms.topic: unit
11+
durationInMinutes: 1
12+
content: |
13+
[!include[](includes/6-summary.md)]
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
IIS organizes web content through a hierarchy of sites, applications, and virtual directories. In this unit, you learn to understand and create new websites, configure web applications within those sites, and set up virtual directories using both the IIS Manager graphical interface and PowerShell.
2+
3+
## The IIS content hierarchy
4+
5+
IIS structures web content in a three-tier hierarchy:
6+
7+
- **Website (Site):** The top-level container. Each site has at least one binding (IP address, port, and optional host name) that identifies incoming requests. A site maps to a physical root directory on disk.
8+
- **Web Application:** A child container within a site. Applications have their own application pool assignment and can have separate configuration settings from the parent site. Use applications when you need isolated configuration, a different .NET runtime, or a dedicated worker process identity for a portion of a site.
9+
- **Virtual Directory:** A pointer from a URL path to a physical directory on disk (which may be on a different volume or UNC path). Virtual directories don't have their own application pool and inherit the parent application's settings.
10+
11+
> [!NOTE]
12+
> This hierarchy is stored in the central IIS configuration file, ApplicationHost.config, located at %windir%\system32\inetsrv\config\.
13+
14+
The following table lists the differences between IIS Web Applications and IIS Virtual Directories.
15+
16+
| **Feature** | **Web application** | **Virtual directory** |
17+
|---|---|---|
18+
| **Has own application pool** | Yes | No (inherits parent app's pool) |
19+
| **Isolated configuration** | Yes | No |
20+
| **Separate .NET runtime** | Yes | No |
21+
| **Physical path** | Local or UNC | Local or UNC |
22+
| **Typical use** | Separate component with own identity/runtime | Alias for supplementary content directory |
23+
24+
## Creating a new website
25+
26+
To add a new site in IIS manager:
27+
28+
1. Open IIS Manager.
29+
1. In the Connections pane on the left, expand the server node, then right-click Sites.
30+
1. Select Add Website.
31+
1. In the Add Website dialog, fill in the following fields:
32+
- Site name: Enter a descriptive name, for example Contoso.
33+
- Application pool: IIS creates a new pool with the same name as the site by default. Accept this or select Select to assign an existing pool.
34+
- Physical path: Enter `C:\inetpub\contoso` or browse to the directory.
35+
- Binding type: Select http.
36+
- IP address: Select All Unassigned unless restricting the site to a specific IP address.
37+
- Port: Enter 80 (or another port if 80 is already in use and you're hosting multiple sites on the same IP address but differentiating based on port).
38+
- Host name: Enter the FQDN for this site, for example www.contoso.com. Host names are required when multiple sites share port 80 or 443 on the same IP address. The sites are differentiated by IIS using the HTTP host header value in each incoming request.
39+
40+
![Screenshot showing the Add Website dialog box.](../media/add-website.png)
41+
42+
1. Leave Start Website immediately checked unless you want to configure the site before it begins serving requests.
43+
1. Select OK.
44+
45+
You can create a site with the `New-Website` cmdlet, which will be installed with the web server role management tools. For example, to create a site named Contoso with the path `D:\contoso` on port 80 that uses the fully qualified domain name www.contoso.com and has a new application pool named Contoso, run the command:
46+
47+
```powershell
48+
New-Website -Name "Contoso" `
49+
-PhysicalPath "D:\contoso" `
50+
-Port 80 `
51+
-HostHeader "www.contoso.com" `
52+
-ApplicationPool "Contoso"
53+
```
54+
55+
You can verify website creation with the `Get-Website` command. For example, to verify the contoso website was created, run the following command:
56+
57+
```powershell
58+
Get-Website -Name "Contoso"
59+
```
60+
61+
## NTFS permissions for web content
62+
63+
When creating a website, configure the directory that hosts the content directory and ensure appropriate NTFS permissions are set. Remember that NTFS permissions are often inherited. Best practice is to use a separate volume for website content rather than storing it on the system volume. Using a separate volume for the website allows you to separate the content from operating system files, it also makes it simpler to back up and restore. You might repartition free space on your existing volume to implement this configuration.
64+
65+
The worker process runs under the application pool identity. For example, a pool named Contoso runs as `IIS AppPool\Contoso`. Application pool identities are:
66+
67+
- Local only
68+
- Noninteractive
69+
- Automatically managed
70+
- Not usable for logon
71+
72+
You should grant the application pool identity `Read and Execute` access to the content folder:
73+
74+
```powershell
75+
$acl = Get-Acl "D:\contoso"
76+
$permission = "IIS AppPool\Contoso", "ReadAndExecute",
77+
"ContainerInherit,ObjectInherit", "None", "Allow"
78+
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
79+
$acl.SetAccessRule($accessRule)
80+
Set-Acl "D:\contoso" $acl
81+
```
82+
83+
Granting permissions directly to that identity ensures:
84+
85+
- Only that specific app can access the files
86+
- Other application pools on the same server can't read or execute the content
87+
- You avoid using broad identities like Everyone, Users, or IIS_IUSRS
88+
89+
Granting `Read and Execute` adheres to the principle of least privilege as IIS only needs read access to serve static content and load assemblies, and execute is required for binaries such as ASP.NET and native modules. You shouldn't assign the Write privilege as this will limit attacks such as:
90+
91+
- Web shell uploads
92+
- Defacement attacks
93+
- Runtime modification of binaries or config files
94+
95+
## Creating web applications
96+
97+
To add a Web Application within a Site
98+
99+
1. In the Connections pane, expand Sites, then select the Contoso site.
100+
1. Right-click the site and select Add Application.
101+
1. In the Add Application dialog, configure:
102+
- Alias: The URL path segment, for example demoapp (accessible at www.contoso.com/demoapp).
103+
- Application pool: Select or create a dedicated pool.
104+
- Physical path: Enter the path to the application's files, for example d:\demoapp.
105+
1. Select OK.
106+
107+
![Screenshot showing the Add Application dialog box.](../media/add-application.png)
108+
109+
You can accomplish this with the following PowerShell command:
110+
111+
```powershell
112+
New-WebApplication -Name "api" `
113+
-Site "Contoso" `
114+
-PhysicalPath "C:\inetpub\contoso-api" `
115+
-ApplicationPool "Contoso-API"
116+
```
117+
118+
## Adding a virtual directory within a site
119+
120+
To add a virtual directory within a site using IIS Manager, perform the following steps:
121+
122+
1. In the Connections pane, right-click the Contoso site (or an application within it) and select Add Virtual Directory.
123+
1. In the Add Virtual Directory dialog, configure:
124+
- Alias: The URL segment, for example downloads.
125+
- Physical path: Enter the directory path, for example D:\shared\downloads.
126+
1. Select OK.
127+
128+
You can add a virtual directory using the PowerShell `New-WebVirtualDirectory` cmdlet. For example, to add a new virtual directory named `downloads` to the `Contoso` site, run the command:
129+
130+
```powershell
131+
New-WebVirtualDirectory -Site "Contoso" `
132+
-Name "downloads" `
133+
-PhysicalPath "D:\shared\downloads"
134+
```

0 commit comments

Comments
 (0)