IIS â Internet Information Services Guide
In this tutorial, you'll learn about IIS. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
Internet Information Services (IIS) is Microsoft's web server for Windows Server and Windows, providing a secure, scalable platform for hosting ASP.NET web applications, static websites, and REST APIs with GUI and command-line management.
What You'll Learn
You'll understand how to install IIS, create websites and application pools, configure SSL/TLS certificates, set up URL rewrite rules, harden security, and troubleshoot common server issues.
Why IIS Matters
IIS powers millions of enterprise websites and internal web applications. It integrates deeply with Windows security (Active Directory, Kerberos), supports classic ASP and ASP.NET Core, and provides a robust management console. DodaTech's enterprise customers host their internal dashboards on IIS.
Real-World Use
A company deploys an ASP.NET Core CRM application for 500 internal users. IIS handles SSL termination, Windows authentication against Active Directory, URL rewriting for clean URLs, and application pool isolation to prevent one site from crashing others.
IIS Learning Path
flowchart LR A["Windows Server Basics"] --> B["IIS Installation"] B --> C["Websites & App Pools"] C --> D["SSL Certificates & HTTPS"] D --> E["URL Rewrite & Modules"] E --> F["Security Hardening"] C:::current classDef current fill:#f90,color:#fff,stroke:#333,stroke-width:2px
Prerequisites: Windows Server 2019/2022 or Windows 10/11 Pro. Administrative access. Basic networking knowledge (ports, DNS, TCP/IP).
Installing IIS
Using PowerShell
# Install IIS web server with commonly used features
Install-WindowsFeature -Name Web-Server, Web-WebSockets, Web-Asp-Net45, `
Web-Mgmt-Console, Web-Url-Rewrite -IncludeManagementTools
# Verify installation
Get-WindowsFeature Web-Server | Select-Object InstallState
Expected output:
InstallState
------------
Installed
Using Server Manager
Open Server Manager â Add Roles and Features â Server Roles â Web Server (IIS). Select these role services:
| Role Service | Purpose |
|---|---|
| Web Server | Core HTTP/HTTPS serving |
| ASP.NET 4.8 | Host .NET Framework apps |
| WebSockets | Real-time communication (SignalR) |
| URL Rewrite | Clean URLs and redirects |
| Management Console | GUI administration |
Creating a Website
Step 1: Create the Site Directory
New-Item -Path "C:\sites\dodatech" -ItemType Directory
Step 2: Create the Website via PowerShell
# Create a new website listening on port 80
New-Website -Name "DodaTech" `
-Port 80 `
-PhysicalPath "C:\sites\dodatech" `
-ApplicationPool "DodaTechPool"
# Create a dedicated application pool
New-WebAppPool -Name "DodaTechPool"
Set-ItemProperty -Path "IIS:\AppPools\DodaTechPool" -Name "managedRuntimeVersion" -Value "v8.0"
# Start the site
Start-Website -Name "DodaTech"
Application Pools: Understanding Isolation
An application pool isolates one or more websites into a separate worker process (w3wp.exe). If one site crashes, others stay running.
| Pool Mode | Behavior | Use Case |
|---|---|---|
| Integrated | ASP.NET and IIS pipeline unified | Modern ASP.NET apps |
| Classic | ASP.NET separate from IIS | Legacy apps |
| No Managed Code | Static files, PHP, Node.js | Non-.NET content |
Configuring SSL/TLS
# Generate a self-signed certificate (dev only)
New-SelfSignedCertificate -DnsName "dodatech.local" -CertStoreLocation "cert:\LocalMachine\My"
# Get certificate thumbprint
$cert = Get-ChildItem -Path "cert:\LocalMachine\My" | Where-Object { $_.Subject -like "*dodatech*" }
# Bind HTTPS to the site
New-WebBinding -Name "DodaTech" -Protocol "https" -Port 443
$cert | New-Item -Path "IIS:\Sites\DodaTech\Bindings\0" -Name "SSL Certificate"
# Redirect HTTP to HTTPS
Install-WindowsFeature Web-Url-Rewrite
# Use URL Rewrite rules for redirect (see below)
Code Example: URL Rewrite Rules
These rules redirect HTTP to HTTPS and enforce trailing slashes:
Via IIS Manager GUI
Or directly in web.config:
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
<rule name="Enforce trailing slash" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}/" />
</rule>
</rules>
</rewrite>
</system.webServer>
Deploying an ASP.NET Core App to IIS
ASP.NET Core apps run as self-contained processes, reverse-proxied by IIS (ANCM â AspNetCore Module).
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*"
modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet"
arguments=".\DodaTech.Web.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
</environmentVariables>
</aspNetCore>
</system.webserver>
Security Hardening Checklist
| Setting | Action | Why |
|---|---|---|
| Remove Server header | Remove-WebConfigurationProperty "system.webServer/security/requestFiltering" -Name "removeServerHeader" |
Hide IIS version from attackers |
| Disable directory browsing | Set directoryBrowse enabled="false" |
Prevent file listing |
| HSTS header | URL Rewrite rule for Strict-Transport-Security |
Enforce HTTPS |
| Request filtering | Limit URL length, query string, content length | Mitigate DoS attacks |
| Dynamic IP Restrictions | Module that blocks IPs with many failed requests | Brute-force protection |
| Application pool identity | Use ApplicationPoolIdentity not NetworkService |
Least Privilege |
Common Errors
HTTP Error 500.19 â Config file error: The
web.confighas a malformed XML element. Validate with an XML validator or use IIS Manager to edit the configuration.HTTP Error 500.30 â ANCM process failed: The ASP.NET Core app failed to start. Check the stdout log file specified in
aspNetCoreelement or the Windows Event Viewer.HTTP Error 403.14 â Directory listing denied: Directory browsing is disabled and no default document exists. Add
index.html,default.aspx, or anindexroute.Cannot connect to site â port already in use: Another process (or another IIS site) is listening on the same port. Run
netstat -ano | findstr :80to find the conflicting PID.Certificate binding fails â invalid certificate store: The certificate must be in the
LocalMachine\Mystore (notCurrentUser). Or the private key is not exportable.401 Unauthorized â Windows Authentication fails: The application pool identity doesn't have permission to the website folder. Grant
Readaccess toIIS AppPool\DodaTechPool.Static files return 404 for ASP.NET Core: You need the
AspNetCoreModuleV2installed. Run the .NET Core Hosting Bundle installer from Microsoft.
Practice Questions
- What is the purpose of an application pool in IIS?
- How do you redirect HTTP to HTTPS in IIS?
- What module does ASP.NET Core use to run under IIS?
- How do you hide the IIS version from HTTP response headers?
- Why should you use
ApplicationPoolIdentityinstead ofNetworkService?
Answers:
- Application pools isolate websites into separate worker processes, so one site crashing doesn't affect others.
- Use the URL Rewrite module with a rule that checks
{HTTPS}is^OFF$and redirects tohttps://{HTTP_HOST}/{R:1}. - The AspNetCore Module (ANCM) version 2 â it reverse-proxies requests to the Kestrel server or hosts in-process.
- Use
Remove-WebConfigurationPropertyforremoveServerHeaderundersecurity/requestFiltering. ApplicationPoolIdentityruns with minimal permissions (a virtual account specific to that pool), reducing the Blast Radius if the app is compromised.
Challenge
Write a PowerShell script that fully configures an IIS server from scratch: installs IIS and the AspNetCore module, creates a new website with HTTPS binding using a Let's Encrypt certificate (via win-acme or Certify), configures HSTS, and sets up a URL Rewrite rule for SEO-friendly URLs.
Real-World Task
You have a legacy ASP.NET Web Forms application and a new ASP.NET Core API. Configure IIS to host both on port 443 using host headers. The API should be at api.dodatech.local, the web app at app.dodatech.local. Both need SSL and separate app pools.
Featured Snippet
What is IIS (Internet Information Services)?
IIS is Microsoft's web server for Windows that hosts ASP.NET, static websites, and APIs, featuring application pool isolation, integrated Windows authentication, URL rewriting, and deep integration with Active Directory.
FAQ
Try It Yourself
What's Next
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro