Run an ASP.NET 4.x website from the command line with IIS Express

iisexpress /path:C:\dev\MySolution\MyWebsite\  

Prerequisite: install IIS Express and add its directory to your PATH.

PS> $addMe = "C:\Program Files (x86)\IIS Express\";  
PS> [Environment]::SetEnvironmentVariable("PATH", $env:Path + ";" + $addMe, [System.EnvironmentVariableTarget]::Machine);  

Note: If you have Visual Studio, you already have IIS Express.

Debugging:

  • From Visual Studio > Debug > Attach to Process > iisexpress.exe
  • From VS Code > TODO.

Why? Opening Visual Studio takes a long time and poses a risk of crashing and freezing. Configuring IIS Express also takes a reasonable amount of time. The lightness of the command line enhances flow.