Learn › Windows Server

IIS Basics: Sites, Application Pools, Bindings and Logs

IIS basics: create a website and app pool, add an HTTPS binding, read IIS logs, and fix common 503 and 500 errors, with GUI and PowerShell steps.

Intermediate 12 min read
By Gopinath Karthikeyan

IIS (Internet Information Services) is Windows Server’s web server. Many internal business apps run on it, so knowing IIS basics is part of almost every Windows admin role.

Lab: Install-WindowsFeature Web-Server -IncludeManagementTools on a test server, then open http://localhost – you’ll see the IIS welcome page.

The four pieces

Piece What it is
Site A website with a name, a folder (physical path) and one or more bindings
Binding How the site is reached: protocol + IP + port + host name, e.g. https *:443 app.contoso.local
Application A sub-folder of a site that runs as its own app, e.g. /api
Application pool The worker process (w3wp.exe) that runs one or more apps, with its own identity and settings

App pools isolate apps from each other: if one crashes or leaks memory, the others keep running. Give important apps their own pool.

How IIS serves a request: HTTP.sys, site binding, application pool and worker process Browser https://shop.contoso.com Browser https://shop.contoso.com HTTPS on port 443 Port 443-ல் HTTPS HTTP.sys Kernel listener that queues requests HTTP.sys Requests-ஐ queue செய்யும் kernel listener Binding: IP + port + host name Binding: IP + port + host name Site: shop Bindings, physical path, settings Site: shop Bindings, physical path, settings Application pool: ShopPool Application pool: ShopPool w3wp.exe Worker processruns the app w3wp.exe App-ஐ இயக்கும்process Identity ApplicationPoolIdentity Identity ApplicationPoolIdentity 503 → pool stopped · 500 → app error Check the logs in C:\inetpub\logs\LogFiles 503 → pool நின்றது · 500 → app error Logs: C:\inetpub\logs\LogFiles
HTTP.sys receives the request, matches it to a site by its binding, and hands it to the site’s application pool, where w3wp.exe runs the code under the pool identity.HTTP.sys request-ஐ பெற்று, binding மூலம் site-ஐ கண்டுபிடித்து, அதன் application pool-க்கு அனுப்புகிறது; அங்கே w3wp.exe pool identity-யில் code-ஐ இயக்குகிறது.

Create a site with PowerShell

Import-Module WebAdministration      # or IISAdministration on newer servers

New-Item -ItemType Directory -Path D:\Sites\DemoApp -Force
Set-Content D:\Sites\DemoApp\index.html '<h1>Demo app works</h1>'

New-WebAppPool -Name DemoAppPool
New-Website -Name DemoApp -PhysicalPath D:\Sites\DemoApp -ApplicationPool DemoAppPool `
    -Port 80 -HostHeader demo.contoso.local

Add a DNS record for demo.contoso.local pointing to the server (or a hosts entry in your lab), then browse to it.

Keep site content on a data drive (like D:\Sites), not in C:\inetpub, so OS changes don’t touch it.

App pool settings that matter

  • .NET CLR version – No Managed Code for static sites and .NET Core/.NET 5+ apps; v4.0 for classic ASP.NET.
  • Identity – ApplicationPoolIdentity by default. If the app reads a network share or a database with Windows authentication, use a dedicated service account instead.
  • Recycling – IIS restarts the worker process every 1740 minutes by default. Many teams change this to a fixed quiet time (e.g. 03:00) so users don’t notice.
  • Rapid-Fail Protection – after 5 crashes in 5 minutes, IIS stops the pool. That’s what causes 503 Service Unavailable.
Get-WebAppPoolState -Name DemoAppPool
Restart-WebAppPool -Name DemoAppPool

Add HTTPS

  1. Get a certificate for the site name and import it into Local Computer → Personal (certlm.msc).
  2. IIS Manager → your site → Bindings → Add → type https, port 443, host name, choose the certificate.
  3. Tick Require Server Name Indication if several HTTPS sites share one IP.
New-WebBinding -Name DemoApp -Protocol https -Port 443 -HostHeader demo.contoso.local -SslFlags 1
$cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object Subject -like '*demo.contoso.local*'
(Get-WebBinding -Name DemoApp -Protocol https).AddSslCertificate($cert.Thumbprint, 'My')

Watch the certificate’s expiry date – an expired certificate is one of the most common avoidable outages.

Logs: where the answers are

IIS logs every request to C:\inetpub\logs\LogFiles\W3SVC<siteID>\ by default. Each line shows time (UTC), client IP, URL, status code, sub-status and time-taken (ms).

# Last 20 requests that returned a server error
Get-Content 'C:\inetpub\logs\LogFiles\W3SVC2\u_ex*.log' -Tail 2000 |
    Where-Object { $_ -match ' 5\d\d ' } | Select-Object -Last 20

Logs grow forever unless you clean them up – schedule a task that deletes logs older than, say, 30 days.

Common errors

Status Usual cause First check
503 App pool stopped (Rapid-Fail) or wrong identity password App pool state; System event log (WAS events)
500.19 Bad web.config or a missing IIS module (e.g. URL Rewrite) The error page shows the config line
500.30 / 502.5 .NET Core app failed to start Application event log; Hosting Bundle installed?
401 Authentication settings or permissions Authentication feature; folder NTFS rights
404 Wrong physical path or missing file Site path; does the file exist?

FAQ

Is iisreset a good fix? It restarts all of IIS and every site on the server. Prefer recycling the one app pool that has the problem.

Where do I find the site ID for the log folder? IIS Manager → Sites shows an ID column, or run Get-Website | Select-Object Name, Id.

What’s next

Next: Patching Windows Server safely.

Practise this topic

Test yourself with free questions on this topic – instant answers and explanations.

Start practice questions

IISWindows ServerWeb ServerPowerShellTroubleshooting

Gopinath Karthikeyan

Gopinath Karthikeyan – Windows Site Reliability Engineer with about 12 years in enterprise Windows Server infrastructure, and founder of WinOps Academy. YouTube · LinkedIn

More in Windows Server