IIS – Windows Webserver mit ASP.NET konfigurieren 2025

Internet Information Services für ASP.NET Core und PHP

S
SeeColors IT
11. Juni 20264 Min. Lesezeit110 Aufrufe

IIS Rolle installieren

# IIS mit wichtigen Features
Install-WindowsFeature -Name Web-Server `
    -IncludeManagementTools `
    -IncludeAllSubFeature

# ASP.NET Core Hosting Bundle (von microsoft.com herunterladen)
# dotnet-hosting-8.0.x-win.exe

# PHP fuer IIS
# PHP Manager (phpiis.codeplex.com)

# URL Rewrite Modul
# Web Platform Installer oder manuell

Erste Website erstellen

# IIS Manager oder PowerShell
Import-Module WebAdministration

# Application Pool erstellen (.NET 8)
New-WebAppPool -Name "MeineApp-Pool"
Set-ItemProperty IIS:\AppPools\MeineApp-Pool `
    -Name managedRuntimeVersion `
    -Value ""  # Kein .NET (fuer .NET Core/5+)
Set-ItemProperty IIS:\AppPools\MeineApp-Pool `
    -Name processModel.identityType `
    -Value 4  # ApplicationPoolIdentity

# Website erstellen
New-Website -Name "MeineApp" `
    -Port 80 `
    -HostHeader "app.firma.de" `
    -PhysicalPath "C:\inetpub\meine-app" `
    -ApplicationPool "MeineApp-Pool"

# Site starten
Start-Website -Name "MeineApp"

SSL-Zertifikat binden

# Let's Encrypt mit win-acme (wacs.exe)
# Download: pkisharp.github.io/win-acme

# Interaktiver Modus
.\wacs.exe

# Automatisch (fuer Scripting)
.\wacs.exe --target iis --siteid 1 `
    --host app.firma.de `
    --emailaddress [email protected] `
    --accepttos

# Zertifikat manuell importieren
Import-PfxCertificate `
    -FilePath "C:\Certs\firma.de.pfx" `
    -CertStoreLocation Cert:\LocalMachine\WebHosting `
    -Password (ConvertTo-SecureString "pfx-passwort" -AsPlainText -Force)

# HTTPS-Binding hinzufuegen
New-WebBinding -Name "MeineApp" `
    -Protocol https `
    -Port 443 `
    -HostHeader "app.firma.de" `
    -SslFlags 1  # SNI

$cert = Get-ChildItem Cert:\LocalMachine\WebHosting | Where-Object {$_.Subject -like "*app.firma.de*"}
(Get-WebBinding "MeineApp" -Protocol https).AddSslCertificate($cert.Thumbprint, "WebHosting")

Application Request Routing (Reverse Proxy)

# IIS als Reverse Proxy fuer interne Dienste
# ARR und URL Rewrite muss installiert sein

# web.config fuer Reverse Proxy:
<!-- C:\inetpub\proxy\web.config -->
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxy" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite"
                        url="http://localhost:3000/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_X_FORWARDED_HOST" value="{HTTP_HOST}" />
                        <set name="HTTP_X_FORWARDED_PROTO" value="https" />
                    </serverVariables>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

IIS Logs analysieren

# IIS Log-Dateien
# Default: C:\inetpub\logs\LogFiles\W3SVC1\

# Logs analysieren (PowerShell)
$logs = Get-Content "C:\inetpub\logs\LogFiles\W3SVC1\u_ex2506*.log" |
    Where-Object {$_ -notlike "#*"}

# Top 10 Status-Codes
$logs | ForEach-Object {
    ($_ -split " ")[8]
} | Group-Object | Sort-Object Count -Descending | Select-Object -First 10

# Fehler-Requests (500er)
$logs | Where-Object {$_ -match " 500 "} | Select-Object -Last 20

FAQ

Kann IIS ASP.NET Core In-Process und Out-of-Process hosten?
Ja. In-Process: schneller, weniger Overhead. Out-of-Process: kestrel laeuft separat, IIS leitet weiter. In-Process wird empfohlen.

Fazit

IIS ist die native Windows-Webserver-Loesung fuer ASP.NET Core, .NET Framework und PHP-Anwendungen mit integrierter IIS-Manager-Verwaltung.

Windows-Webserver und IIS-Konfiguration fuer KMU in Heidelberg, Mannheim und der Rhein-Neckar-Region. Beratung anfragen.

Artikel teilen

War dieser Artikel hilfreich?

Dein Feedback hilft uns, bessere Inhalte zu erstellen.

Kommentar hinterlassen

Verwandte Artikel