Roadmap › IIS — Internet Information Services and Hosting .NET Applications › Module: IIS Architecture
Lessons in this course (9)
2. Sites, bindings, applications and virtual directories
Basic★ Must knowLesson 2 of 9
powershell
Import-Module WebAdministration
New-Item -ItemType Directory C:\sites\shop -Force
New-WebAppPool -Name "ShopPool"
New-Website -Name "Shop" -PhysicalPath "C:\sites\shop" -ApplicationPool "ShopPool" -Port 80 -HostHeader "www.shop.com"
New-WebBinding -Name "Shop" -Protocol https -Port 443 -HostHeader "www.shop.com" -SslFlags 1 # 1 = SNI
New-WebApplication -Site "Shop" -Name "api" -PhysicalPath "C:\sites\shop-api" -ApplicationPool "ShopApiPool"
New-WebVirtualDirectory -Site "Shop" -Name "downloads" -PhysicalPath "D:\shared\downloads"- Binding = protocol + IP (or
*) + port + host header. Several sites can share port 80/443 if host names differ. - SNI (Server Name Indication) lets many HTTPS sites with different certificates share one IP:443.
- An application under a site (
/api) can run in a different app pool and has its ownweb.configroot for ASP.NET. - A virtual directory only maps a URL to a folder (no separate app/pool).
hostsfile (C:\Windows\System32\drivers\etc\hosts) can mapwww.shop.comto127.0.0.1for local testing.