Installer et configurer Internet Information Services (IIS) pour héberger des sites web et applications ASP.NET sur Windows Server.
http://localhost — la page d'accueil IIS par défaut s'affiche.C:\Sites\MonSite et placez-y vos fichiers (ex : index.html).inetmgr).MonSite.C:\Sites\MonSite.monsite.local.monsite.local.| Protocole | Port | Usage |
|---|---|---|
| HTTP | 80 | Site web standard (non chiffré) |
| HTTPS | 443 | Site web sécurisé (SSL/TLS) |
| HTTP | 8080 | Port alternatif (intranet, API) |
C:\Sites\MonSite\.MonSite → Paramètres avancés.http://monsite.local.No Managed Code (le runtime est géré par Kestrel derrière IIS).
C:\inetpub\logs\LogFiles\.Retrouvez ci-dessous les commandes PowerShell correspondant à chaque étape du tutoriel.
# Installer IIS
Install-WindowsFeature -Name Web-Server -IncludeManagementTools
# Modules complémentaires
Install-WindowsFeature -Name Web-Asp-Net45, Web-Net-Ext45, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Mgmt-Console, Web-Log-Libraries
# Vérification
Invoke-WebRequest -Uri http://localhost -UseBasicParsing | Select-Object StatusCode
# Créer le dossier et la page de test
New-Item -Path "C:\Sites\MonSite" -ItemType Directory -Force
"<h1>Mon site fonctionne !</h1>" | Out-File "C:\Sites\MonSite\index.html" -Encoding UTF8
# Créer le site
Import-Module WebAdministration
New-IISSite -Name "MonSite" -PhysicalPath "C:\Sites\MonSite" -BindingInformation "*:80:monsite.local"
# Récupérer le certificat SSL
$cert = Get-ChildItem Cert:\LocalMachine\My |
Where-Object { $_.Subject -like "*monsite.local*" }
# Ajouter le binding HTTPS
New-IISSiteBinding -Name "MonSite" `
-BindingInformation "*:443:monsite.local" `
-Protocol https `
-CertificateThumbPrint $cert.Thumbprint `
-CertStoreLocation "Cert:\LocalMachine\My"
# Lister les bindings
Get-IISSiteBinding -Name "MonSite" | Format-Table
# Copier les fichiers
Copy-Item -Path "C:\Deploy\MonApp\*" -Destination "C:\Sites\MonSite\" -Recurse -Force
# Configurer le pool .NET
Set-ItemProperty "IIS:\AppPools\MonSite" -Name managedRuntimeVersion -Value "v4.0"
# Redémarrer le pool
Restart-WebAppPool -Name "MonSite"
# Tester
Invoke-WebRequest -Uri http://monsite.local -UseBasicParsing | Select-Object StatusCode
# État des sites
Get-IISSite | Select-Object Name, State, Bindings | Format-Table -AutoSize
# Logs d'accès
Get-Content "C:\inetpub\logs\LogFiles\W3SVC1\*.log" -Tail 20
# Redémarrer IIS
iisreset /restart
# Vérifier les ports
netstat -an | Select-String ":80 |:443 "