IIS web server: sites, app pools, HTTPS and Kerberos

A lot of company apps are internal websites: HR portals, dashboards, ticket systems. On Windows most of them run on the IIS web server, and when one breaks, the server admin gets the first call.

You’ll install IIS on SRV01, publish the intranet site at intranet.saatlab.internal and run it as the gmsa_intranet account from Lesson 22. Then you’ll add HTTPS, switch on Windows authentication with Kerberos and fix an HTTP 500 and an HTTP 401.

TimeYou needBy the end you can
About 75 minutesDC01, SRV01 and CL01; the intranet DNS record (Lesson 14), SPN (Lesson 21) and gMSA (Lesson 22)Install IIS, create sites, app pools and bindings, use a gMSA identity, configure HTTPS and Windows authentication, and read IIS status codes and logs

What it is, in one line

The IIS web server (Internet Information Services) is the web server role built into Windows Server; it hosts websites and web apps and handles HTTP and HTTPS requests.

In Simple Words

A restaurant with a host and kitchens

In a big restaurant the host at the door checks your booking and sends you to the right dining room, and each dining room has its own kitchen team, so a fire in one kitchen doesn’t stop the rest. IIS is laid out the same way. The binding (name, IP and port) is the booking the host checks, each site is a dining room, and each application pool is a separate kitchen running in its own process. The certificate is the licence hanging on the wall that proves to guests they’ve come to the real place.

Engineer's View

HTTP.sys, sites, app pools, auth

Architecture: requests arrive at the kernel driver HTTP.sys, which queues each one for the right application pool. A pool runs one or more w3wp.exe worker processes under an identity, which is ApplicationPoolIdentity by default but can be a domain account or a gMSA. If a pool keeps crashing, rapid-fail protection stops it and visitors get HTTP 503.

Sites and bindings: a site has a physical path plus bindings made of protocol, IP, port and host name, and several sites can share port 443 by using host names and SNI. The configuration is kept in applicationHost.config and in web.config files in individual folders.

Authentication: Windows authentication uses Negotiate, which tries Kerberos and falls back to NTLM. For Kerberos to work, the account that decrypts tickets needs an HTTP SPN. By default IIS decrypts with the computer account (kernel-mode auth), so if you use a custom app pool identity that holds the SPN, set useAppPoolCredentials to true.

Status codes and logs: 401 is authentication, 403 authorisation, 404 not found, 500 a server error (500.19 means bad configuration) and 503 a stopped pool. The IIS logs sit in C:\inetpub\logs\LogFiles, and their substatus and Win32 status codes point you to the real cause.

How it works, step by step

Here’s what happens when Priya opens https://intranet.saatlab.internal on CL01:

IIS web server request flow: DNS, HTTP.sys binding, app pool and Windows authentication

Kerberos shows up again here: the browser asks DC01 for a ticket for HTTP/intranet.saatlab.internal, and IIS decrypts it with gmsa_intranet’s key. If the SPN, the app pool identity and useAppPoolCredentials don’t line up, the result is a 401.

The intranet setup on SRV01:

IIS web server intranet setup: site, gMSA app pool, authentication and certificate
  1. Install IIS with Windows authentication.
  2. Create the content folder, the IntranetPool app pool running as gmsa_intranet$, and the Intranet site.
  3. Add HTTPS with a self-signed certificate for now (Lesson 34 replaces it with one from your own CA).
  4. Switch to Windows authentication only, using the app pool’s credentials for Kerberos.
  5. Test from CL01 and confirm the Kerberos ticket.

Hands-on Lab: IIS web server for the SaatLab intranet

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

Start DC01, SRV01 and CL01, then sign in to SRV01 as SAATLAB\Administrator and work in PowerShell as administrator.

1Install IIS

On SRV01, run this:

Install-WindowsFeature Web-Server, Web-Windows-Auth -IncludeManagementTools
Import-Module WebAdministration
Get-Website | Select-Object Name, State, PhysicalPath

You should see something like this:

Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True    No             Success   {Common HTTP Features, Default Document, Directory Browsing, ...}

Name             State   PhysicalPath
----             -----   ------------
Default Web Site Started %SystemDrive%\inetpub\wwwroot

✅ Checkpoint: IIS is installed and the Default Web Site is Started.

2Create the content, app pool and site

On SRV01, run this:

New-Item -ItemType Directory D:\Sites\Intranet -Force | Out-Null
'<html><body><h1>SaatLab Intranet</h1><p>Welcome to the lab intranet.</p></body></html>' | Set-Content D:\Sites\Intranet\index.html
icacls D:\Sites\Intranet /grant "SAATLAB\gmsa_intranet$:(OI)(CI)RX" "SAATLAB\Domain Users:(OI)(CI)RX" | Out-Null

New-WebAppPool -Name IntranetPool | Out-Null
Set-ItemProperty IIS:\AppPools\IntranetPool -Name processModel -Value @{userName='SAATLAB\gmsa_intranet$'; password=''; identityType=3}
New-Website -Name Intranet -PhysicalPath D:\Sites\Intranet -ApplicationPool IntranetPool -HostHeader intranet.saatlab.internal -Port 80 | Out-Null
Get-Website -Name Intranet | Select-Object Name, State, Bindings
(Get-ItemProperty IIS:\AppPools\IntranetPool -Name processModel).userName

You should see something like this:

Name     State   Bindings
----     -----   --------
Intranet Started Microsoft.IIs.PowerShell.Framework.ConfigurationElement

SAATLAB\gmsa_intranet$

identityType 3 means “specific user”, and leaving the password empty is how you tell IIS it’s a gMSA, because Windows fetches the password from AD. The gMSA has to be installed on SRV01 (you did that in Lesson 22); if it isn’t, the pool won’t start and the site returns 503.

✅ Checkpoint: The Intranet site is Started, and IntranetPool runs as SAATLAB\gmsa_intranet$.

3Add HTTPS with a certificate

On SRV01, create a certificate and bind it:

$cert = New-SelfSignedCertificate -DnsName intranet.saatlab.internal -CertStoreLocation Cert:\LocalMachine\My -NotAfter (Get-Date).AddYears(1)
New-WebBinding -Name Intranet -Protocol https -Port 443 -HostHeader intranet.saatlab.internal -SslFlags 1
(Get-WebBinding -Name Intranet -Protocol https).AddSslCertificate($cert.Thumbprint, 'My')
Export-Certificate -Cert $cert -FilePath D:\Sites\intranet.cer | Out-Null
Get-WebBinding -Name Intranet | Select-Object protocol, bindingInformation, sslFlags

You should see something like this:

protocol bindingInformation              sslFlags
-------- ------------------              --------
http     *:80:intranet.saatlab.internal         0
https    *:443:intranet.saatlab.internal        1

SslFlags 1 turns on SNI, which lets other sites share port 443 with their own certificates. Other computers won’t trust a self-signed certificate, so in the lab you’ll trust it on CL01 by hand, and in Lesson 34 you’ll swap it for one issued by your own CA that everything trusts automatically.

✅ Checkpoint: The site has an http and an https binding for intranet.saatlab.internal.

4Turn on Windows authentication with Kerberos

On SRV01, change the authentication settings for the Intranet site:

$auth = 'system.webServer/security/authentication'
Set-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location 'Intranet' -Filter "$auth/anonymousAuthentication" -Name enabled -Value $false
Set-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location 'Intranet' -Filter "$auth/windowsAuthentication" -Name enabled -Value $true
Set-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location 'Intranet' -Filter "$auth/windowsAuthentication" -Name useAppPoolCredentials -Value $true
Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location 'Intranet' -Filter "$auth/windowsAuthentication" -Name useAppPoolCredentials | Select-Object Value

You should see this:

Value
-----
 True

With anonymous access off, every visitor has to prove who they are. useAppPoolCredentials tells IIS to decrypt Kerberos tickets with gmsa_intranet’s key, which matches the HTTP SPN you moved to that account in Lesson 22.

✅ Checkpoint: Anonymous is disabled, Windows authentication is enabled, and useAppPoolCredentials is True.

5Test from CL01 and confirm Kerberos

On CL01, as an administrator, trust the lab certificate:

Import-Certificate -FilePath \\SRV01\D$\Sites\intranet.cer -CertStoreLocation Cert:\LocalMachine\Root | Out-Null

Then sign in as Priya and, in a normal PowerShell window:

klist purge | Out-Null
$r = Invoke-WebRequest -Uri https://intranet.saatlab.internal -UseDefaultCredentials -UseBasicParsing
$r.StatusCode
klist | Select-String 'Server:'

You should see something like this:

200
        Server: krbtgt/SAATLAB.INTERNAL @ SAATLAB.INTERNAL
        Server: HTTP/intranet.saatlab.internal @ SAATLAB.INTERNAL

StatusCode 200 means the page loaded, and the HTTP/intranet.saatlab.internal ticket proves Kerberos handled the authentication. Try the site in Edge on CL01 as well; it should open with a padlock and no password prompt.

Now look at the log entry for that request on SRV01:

Get-ChildItem C:\inetpub\logs\LogFiles\W3SVC2 | Sort-Object LastWriteTime | Select-Object -Last 1 | Get-Content -Tail 2

You should see something like this:

2026-10-19 15:12:40 10.0.0.20 GET / - 443 - 10.0.0.150 Mozilla/5.0+(Windows+NT;...) - 401 2 5 3
2026-10-19 15:12:40 10.0.0.20 GET / - 443 SAATLAB\priya.sharma 10.0.0.150 Mozilla/5.0+(Windows+NT;...) - 200 0 0 15

The first request gets 401.2 because it carries no credentials yet, the browser replies with a Kerberos ticket, and the second request gets 200 with Priya’s name on it. A 401 followed by a 200 is normal; it’s when you see only 401s that you have a problem.

✅ Checkpoint: CL01 gets 200, holds an HTTP/intranet ticket, and the IIS log shows priya.sharma with status 200.

IIS web server lab: status 200 and an HTTP/intranet Kerberos ticket on CL01
The page loads with status 200, and the HTTP/intranet ticket proves Kerberos was used.

Break It, Then Fix It

Every web admin knows these two errors by heart: a 500 caused by broken configuration, and a 401 that won’t go away.

1Break it: a broken web.config

On SRV01, add a web.config that has a typo in it (a closing tag is missing):

'<configuration><system.webServer><defaultDocument enabled="true"></system.webServer></configuration>' | Set-Content D:\Sites\Intranet\web.config

On CL01 as Priya:

Invoke-WebRequest -Uri https://intranet.saatlab.internal -UseDefaultCredentials -UseBasicParsing

You’ll get an error like this:

Invoke-WebRequest : The remote server returned an error: (500) Internal Server Error.
At line:1 char:1
+ Invoke-WebRequest -Uri https://intranet.saatlab.internal -UseDefaultCredentials -UseBasicParsing
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

All the client sees is 500, but the log on SRV01 gives you the substatus:

Get-ChildItem C:\inetpub\logs\LogFiles\W3SVC2 | Sort-Object LastWriteTime | Select-Object -Last 1 | Get-Content -Tail 1

You should see something like this:

2026-10-19 15:20:03 10.0.0.20 GET / - 443 - 10.0.0.150 Mozilla/5.0+(Windows+NT;...) - 500 19 13 0

500.19 means “configuration data is invalid”, and Win32 status 13 is “the data is invalid”. If you open the site in a browser on SRV01 itself, IIS shows a detailed error page with the exact line of web.config, while remote users get only a generic error, which is deliberate.

Fix it: correct the file (or remove it, since the site doesn’t need it):

'<configuration><system.webServer><defaultDocument enabled="true" /></system.webServer></configuration>' | Set-Content D:\Sites\Intranet\web.config

✅ Checkpoint: The site returned 500.19 with the broken web.config and 200 after the fix.

2Break it: Kerberos that can’t be decrypted

On SRV01, switch off useAppPoolCredentials:

Set-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location 'Intranet' -Filter 'system.webServer/security/authentication/windowsAuthentication' -Name useAppPoolCredentials -Value $false

On CL01 as Priya:

klist purge | Out-Null
Invoke-WebRequest -Uri https://intranet.saatlab.internal -UseDefaultCredentials -UseBasicParsing

You’ll get an error like this:

Invoke-WebRequest : The remote server returned an error: (401) Unauthorized.

Look at CL01’s System log:

Get-WinEvent -FilterHashtable @{LogName='System'; ProviderName='Microsoft-Windows-Security-Kerberos'} -MaxEvents 1 | Select-Object Id, Message | Format-List

You should see something like this:

Id      : 4
Message : The Kerberos client received a KRB_AP_ERR_MODIFIED error from the server srv01$. The target name used was
          HTTP/intranet.saatlab.internal. This indicates that the target server failed to decrypt the ticket provided
          by the client. ...

The DC encrypted Priya’s ticket with gmsa_intranet’s key because that account holds the SPN, but IIS tried to decrypt it with SRV01’s computer key and failed. In Edge you’d see a password box that never accepts anything, which is the classic symptom.

Fix it: make the decrypting account match the SPN again:

Set-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location 'Intranet' -Filter 'system.webServer/security/authentication/windowsAuthentication' -Name useAppPoolCredentials -Value $true

You could also fix it the other way, by moving the SPN to the SRV01 computer account and leaving useAppPoolCredentials off. Either works, as long as the SPN sits on the account that does the decrypting.

✅ Checkpoint: CL01 got 401 with Kerberos event 4 (KRB_AP_ERR_MODIFIED) and 200 again after the fix.

IIS web server lab: 401 Unauthorized and KRB_AP_ERR_MODIFIED event
When IIS decrypts with the wrong account, CL01 gets 401 and logs KRB_AP_ERR_MODIFIED.

This happened at work

The certificate that expired on a Monday

A company’s HR portal ran on IIS with a certificate that a contractor had bought two years earlier, and the contractor had since left. Nobody had the expiry date in a calendar. One Monday morning, 2,000 staff got a full-page browser warning instead of the portal. Worse, overnight the payroll system had called the portal’s API, refused the expired certificate and quietly skipped the import, and nobody noticed until the payslips came out wrong. Getting a new certificate issued and bound took under an hour, but sorting out the payroll import took the rest of the week.

The fix: every internal site moved to certificates from the company’s own CA with auto-enrolment, and a weekly script now lists the certificate on every IIS binding with its days to expiry and raises an alert at 30 days.

The lesson: a certificate always expires, and you know the date in advance, so either track it or let automation renew it.

Common mistakes and troubleshooting

Mistake or symptomWhat happensWhat to do instead
HTTP 503 Service UnavailableThe app pool is stopped, often by a bad identityCheck the pool state and the System log; fix the identity or gMSA
HTTP 500.19web.config or applicationHost.config is invalidRead the detailed error on the server; fix the XML
Endless password prompts (401)Kerberos can’t be decrypted: SPN and identity don’t matchAlign the SPN with the decrypting account; useAppPoolCredentials
HTTP 403The user is authenticated but not allowedCheck NTFS permissions and IIS authorisation rules
Same app pool for every siteOne crash takes all sites downA pool per site or app
Self-signed certificates in productionWarnings and failed API callsCertificates from your CA or a public CA
No certificate expiry trackingOutages on known datesReport and alert on expiry; auto-renew
Detailed errors shown to remote usersInformation leaksKeep detailed errors local only (the default)
Ignoring IIS logsGuessing at causesUse status, substatus and Win32 codes in the logs

Interview questions

Click a question to open it. Each one is phrased the way an interviewer would ask it, and underneath you’ll find why they ask it and one way you could answer in your own words.

Fresher level

1. Can you explain in simple words what an application pool is in IIS?

Why they ask this: They’re checking your IIS basics, because app pools sit behind most of the IIS problems you’ll troubleshoot.

How you might answer: It’s a group of worker processes, w3wp.exe, that runs one or more web apps under a set identity. Pools are isolated from each other, so if one app crashes, the apps in other pools keep running.

2. What is a binding on an IIS site?

Why they ask this: They want to know you understand how IIS decides which site answers a request.

How you might answer: It’s the protocol, IP address, port and host name a site listens on, for example https on port 443 for intranet.saatlab.internal.

3. A user sends you a screenshot of an error page. What’s the difference between a 401, a 403, a 404 and a 500?

Why they ask this: They want to see you can read status codes quickly, since the code tells you where to start looking.

How you might answer: 401 means the user isn’t authenticated, 403 means they’re authenticated but not allowed, and 404 means the page wasn’t found. A 500 is something going wrong on the server side, so I’d go to the app and its logs.

2–5 years experience

4. It’s Monday morning and the intranet site shows 503 Service Unavailable. Where do you start?

Why they ask this: They want a structured approach that starts with the app pool, since that’s the usual cause of a 503.

How you might answer: I’d check first whether the app pool is stopped, and then look in the System and Application logs for WAS errors. Next I’d look at the pool identity, say an expired password or a gMSA problem, and whether rapid-fail protection has stopped the pool. I’d also ask if anyone changed the config recently.

5. Your site runs on a custom app pool identity, and Windows authentication keeps falling back to NTLM. How would you make it use Kerberos?

Why they ask this: They’re checking you understand SPNs in IIS, which catch out a lot of admins.

How you might answer: I’d register the HTTP/hostname SPN on the app pool account and set useAppPoolCredentials to true. Or I could put the SPN on the computer account and use kernel-mode authentication with the default settings.

6. You need to host three HTTPS sites on one server with only one IP address. How would you do it?

Why they ask this: They want to know if you understand SNI and how certificates work with host names.

How you might answer: I’d use host name bindings on port 443 with Server Name Indication turned on, which is SslFlags 1, and give each site its own certificate. Another way is a single wildcard or SAN certificate that covers all the names.

Senior level

7. The business says an internal IIS app can’t go down anymore. How would you make it highly available?

Why they ask this: They want to see you think about the whole design and not only about adding a second server.

How you might answer: I’d put two or more IIS servers behind a load balancer with health probes, and keep content and config in step with shared configuration or a deployment pipeline. Session state would move out of process, and the certificates would either sit on each node or be offloaded at the load balancer.

8. You’re asked to secure a new IIS server before it goes live. What would you do?

Why they ask this: They’re checking you know web-specific hardening on top of general server hardening.

How you might answer: I’d install only the modules we need, allow TLS 1.2 and above, switch on HSTS and request filtering, and run pools under least-privilege identities. Remote users wouldn’t see detailed errors. I’d also forward the logs, keep the server patched and put a WAF or reverse proxy at the edge.

9. An app works fine with a few users but gets slow under load. What would you look at?

Why they ask this: They want to see you look past the IIS settings at the whole path, database included.

How you might answer: I’d look at the request queues, the time-taken field in the logs and the CPU and memory of the worker processes, and Failed Request Tracing would show me where the slow requests spend their time. After that I’d check app pool recycling, latency to the backend database and the ASP.NET and Web Service performance counters.

Quick quiz

Q1. What is the IIS worker process called?

  1. iis.exe
  2. w3wp.exe
  3. httpd.exe
Show answer

B — Each app pool runs w3wp.exe processes.

Q2. Why use an empty password for the gmsa_intranet$ pool identity?

  1. It’s a mistake
  2. Windows fetches gMSA passwords from AD
  3. Anonymous access
Show answer

B — That’s how IIS uses a gMSA.

Q3. What does HTTP 500.19 mean?

  1. Login failed
  2. Invalid configuration data
  3. Pool stopped
Show answer

B — Check web.config.

Q4. Why did CL01 get 401 with KRB_AP_ERR_MODIFIED?

  1. Wrong password
  2. IIS decrypted with a different account than the SPN holder
  3. Expired certificate
Show answer

B — Align the SPN and the decrypting account.

Q5. In the work story, what caused the payroll problem?

  1. A virus
  2. An expired certificate on the portal
  3. A full disk
Show answer

B — Track and auto-renew certificates.

Quick recap

  • The IIS web server hosts sites with bindings, each app in its own application pool.
  • A gMSA pool identity has an empty password, and Windows fetches the real one from AD.
  • HTTPS needs a certificate and a 443 binding, and SNI lets several sites share one IP.
  • Windows authentication with Kerberos needs the SPN on the decrypting account (useAppPoolCredentials).
  • In the IIS logs, read status, substatus and Win32 codes: 500.19 is config, 401 is auth, 503 is the pool.
  • Track certificate expiry.

Next lesson

Lesson 26: Remote access → Next you’ll secure RDP with NLA and groups, install Remote Desktop Session Host and RD Web Access, publish a RemoteApp and take a look at RD Gateway, VPN with RRAS, and NPS for RADIUS.

Further reading: IIS web server

Want to go deeper into IIS web server? Microsoft’s guide to Kerberos failures in IIS covers SPNs and useAppPoolCredentials, and the HTTP status code reference for IIS lists every substatus. You can also see the full plan for this course on the Windows Server Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.