Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Windows Server

Install IIS on Windows Server with PowerShell

Install IIS on Windows Server 2019 to 2025 with PowerShell, create a site and app pool, set permissions, add a free certificate and host ASP.NET Core.

CloudSat teamNovember 18, 20266 min read
Abstract illustration of a window-shaped gateway with glowing site tiles passing through it into a server rack
On this pageChoose the role services first

IIS is the web server built into Windows Server, and on a remote server it is easiest to manage from PowerShell: the same script builds the second server exactly like the first, and it works on Server Core, which has no desktop at all. This guide installs IIS with only the parts you need, creates a site with its own application pool and permissions, opens the firewall, adds a free certificate, and prepares the server for ASP.NET Core. IIS has been version 10 since Windows Server 2016, and every command below works the same on 2019, 2022 and 2025.

Choose the role services first

IIS is modular, and every module you skip is code that cannot be attacked. The names below are what Install-WindowsFeature expects:

Feature name What it adds Install it when
Web-Server The web server: static files, default documents, logging, request filtering Always
Web-Mgmt-Console IIS Manager, the graphical console You want a GUI on servers with Desktop Experience
Web-Mgmt-Service Remote management service, listening on port 8172 You manage IIS from another machine
Web-Asp-Net45 ASP.NET 4.x (with Web-Net-Ext45) You host classic ASP.NET apps
Web-WebSockets WebSocket protocol Apps with live updates or chat
Web-Http-Redirect HTTP redirection rules You redirect sites or paths
Web-Dyn-Compression Compression of dynamic responses Busy text-heavy apps
Web-Windows-Auth, Web-Basic-Auth Authentication methods Intranet or protected sites

ASP.NET Core apps need none of the ASP.NET 4.x features; they use their own module, installed later in this guide.

Install IIS

From an administrator PowerShell session:

Install-WindowsFeature -Name Web-Server -IncludeManagementTools
Install-WindowsFeature -Name Web-WebSockets, Web-Http-Redirect, Web-Dyn-Compression
Get-WindowsFeature -Name Web-* | Where-Object Installed | Select-Object Name, DisplayName

-IncludeManagementTools adds IIS Manager on servers with a desktop; without it, Install-WindowsFeature installs no management tools. Check that the server answers locally:

(Invoke-WebRequest -Uri http://localhost -UseBasicParsing).StatusCode

A 200 means the default site is serving its welcome page. On Windows 11, for local development, the equivalent is Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-ManagementConsole -All.

Create a site with its own application pool

Each site should run in its own application pool, so a crash or a memory leak in one cannot take the others down, and each pool gets its own identity for file permissions.

Import-Module WebAdministration

New-Item -ItemType Directory -Path C:\sites\example.com | Out-Null
Set-Content -Path C:\sites\example.com\index.html -Value '<h1>It works</h1>'

New-WebAppPool -Name 'example.com'
Set-ItemProperty -Path 'IIS:\AppPools\example.com' -Name managedRuntimeVersion -Value ''
New-Website -Name 'example.com' -PhysicalPath 'C:\sites\example.com' `
  -HostHeader 'example.com' -Port 80 -ApplicationPool 'example.com'

Remove-Website -Name 'Default Web Site'

An empty managedRuntimeVersion is the No Managed Code setting, right for static sites and for ASP.NET Core. Set it to v4.0 instead for classic ASP.NET 4.x apps. Removing the default site keeps it from answering for host names you never configured; recreate it later if you need it.

Give the pool access to its files, and nothing more

New pools run as ApplicationPoolIdentity, a virtual account named after the pool. Grant it read access to the site and write access only where the app writes:

icacls C:\sites\example.com /grant "IIS AppPool\example.com:(OI)(CI)RX"
New-Item -ItemType Directory -Path C:\sites\example.com\App_Data | Out-Null
icacls C:\sites\example.com\App_Data /grant "IIS AppPool\example.com:(OI)(CI)M"

(OI)(CI) makes the rule apply to files and subfolders, RX is read and execute, and M is modify. An uploads folder the pool can write to should never be a place it can also execute scripts from.

Open the firewall

Create an explicit inbound rule instead of relying on whatever the installer enabled, then confirm it:

New-NetFirewallRule -DisplayName 'Web HTTP and HTTPS' -Direction Inbound -Protocol TCP -LocalPort 80,443 -Action Allow
Get-NetFirewallRule -DisplayName 'Web HTTP and HTTPS' | Select-Object DisplayName, Enabled, Action

If you installed the management service, do not open port 8172 to the internet; allow it only from your own address with -RemoteAddress. On CloudSat, open the same ports in the console as well if the server sits behind a cloud firewall.

Add HTTPS with win-acme

win-acme is the long-standing free ACME client for IIS. Version 2.4.1, released on November 10, 2026, runs on .NET 10, and development now continues in its simple-acme successor. It asks the certificate authority for a certificate, adds the HTTPS binding to the site and schedules renewals.

  1. Point the domain's A record at the server and make sure port 80 is reachable; the default validation happens over HTTP.
  2. Download the release ZIP from the project's GitHub page, unpack it to a folder such as C:\tools\win-acme, and run wacs.exe as administrator.
  3. Choose N to create a certificate with default settings, then pick the IIS site.

Release notes for 2.4.1 say new installations default to ZeroSSL as the certificate authority. If you want Let's Encrypt, say so explicitly the first time you run it:

C:\tools\win-acme\wacs.exe --baseuri https://acme-v02.api.letsencrypt.org/

win-acme creates a scheduled task that runs daily as SYSTEM and renews certificates well before they expire. To send plain HTTP visitors to HTTPS, install the URL Rewrite 2.1 module from iis.net and add a rule to the site's web.config, keeping the validation path out of the redirect:

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" />
            <add input="{REQUEST_URI}" pattern="^/\.well-known/acme-challenge/" negate="true" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Prepare the server for ASP.NET Core

ASP.NET Core apps run through the ASP.NET Core Module, which comes with the .NET Hosting Bundle. Order matters: install IIS first, then the bundle. If the bundle went in first, run its installer again and choose Repair. After installing, restart the server or restart the IIS services:

net stop was /y
net start w3svc

Publish the app into the site folder with dotnet publish -c Release -o C:\sites\example.com. The generated web.config loads AspNetCoreModuleV2, and the pool stays on No Managed Code. Apps that still need ASP.NET 3.5 depend on .NET Framework 3.5, covered in Install .NET Framework 3.5 on Windows Server and Windows 11.

For reverse-proxying to Node.js or another backend, Application Request Routing 3.0 adds proxying on top of URL Rewrite.

Where to look when a site fails

Symptom First place to look
A 503 for every request The pool stopped, often after repeated crashes; check System and Application in Event Viewer, then restart it with Start-WebAppPool
A 500.19 error Invalid web.config, often a rule for a module that is not installed, such as URL Rewrite
A 500.30 error on an ASP.NET Core site The app failed to start; set stdoutLogEnabled="true" in web.config temporarily and read the log
Requests rejected before reaching the site C:\Windows\System32\LogFiles\HTTPERR
Anything else The site's logs under C:\inetpub\logs\LogFiles, one folder per site ID

Windows Server with IIS wants 2 GB of memory or more. CloudSat plans that run Windows start at $2.78/mo, and a Windows VPS gives you full administrator access over RDP for everything above.

FAQ

Can one IIS server host several HTTPS sites on one IP address?

Yes. Each site gets its own host name binding, and Server Name Indication picks the right certificate for each. win-acme sets the binding flags for you; by hand, it is -SslFlag Sni on New-IISSite.

Do I need IIS to run ASP.NET Core?

No. ASP.NET Core includes its own web server, Kestrel. IIS in front adds process management, Windows authentication, centralized certificates and port sharing between sites, which is why most Windows servers keep it.

Should I install IIS Manager on a server?

On servers with Desktop Experience it is convenient and harmless. On Server Core, manage IIS with PowerShell, or from another machine through the management service restricted to your address.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.