I usually run the Web projects from Visual Studio. But it was required to run an ASP.NET Core 3.1 Web project from the Command Line on IIS Express

At first I thought it was easy! But I stumbled in some places. To keep this article simple, I don’t want to write all my tries.

Here’s how you can start an ASP.NET Core 3.1 Web Project from the Command Line


SET ASPNETCORE_ENVIRONMENT=DevelopmentSET LAUNCHER_PATH=bin\Debug\netcoreapp3.1\Volo.AbpIo.Account.Web.execd /d "C:\Program Files\IIS Express\"iisexpress.exe /config:"D:\Github\volo\abp\abp_io\.vs\Volo.AbpIo\config\applicationhost.config" /site:"Volo.AbpIo.Account.Web" /apppool:"Volo.AbpIo.Account.Web AppPool"

You need to modify the bold ones in the batch file. Descriptions:

  • LAUNCHER_PATH: This is the exe file of your Web project. Be careful you don’t provide the full exe path. Set it as relative path. My CSPROJ is located in “D:\Github\volo\abp\abp_io\src\Volo.AbpIo.Account.Web\Volo.AbpIo.Account.Web.csproj” and I set LAUNCHER_PATH as “bin\Debug\netcoreapp3.1\Volo.AbpIo.Account.Web.exe”

  • /config: This is the applicationhost.config file path. My solution path is “D:\Github\volo\abp\abp_io\Volo.AbpIo.sln” and applicationhost.config is located in the “D:\Github\volo\abp\abp_io.vs\Volo.AbpIo\config\applicationhost.config

  • /site: You can find the site name in the applicationhost.config file. It’s in the ** tag.

  • /apppool: You can find the site name in the applicationhost.config file. It’s in the your ** tag.

applicationhost.config File Content:

....<site name="Volo.AbpIo.Account.Web" id="2">
        <application path="/" applicationPool="Volo.AbpIo.Account.Web AppPool">
          <virtualDirectory path="/" physicalPath="D:\Github\volo\abp\abp_io\src\Volo.AbpIo.Account.Web" />
          <binding protocol="http" bindingInformation="*:56570:localhost" />
          <binding protocol="https" bindingInformation="*:44333:localhost" />

And this is the GitHub Gist

When you create a batch file as “run-host.bat” and run it, it’ll run as seen below:


Command line output window

You’ll also see the system tray application of IIS Express. Right click on it and click “Show All Applications” to see your running Web Apps.


Windows System Tray Icon

If you encounter any problem while running the application, check your Windows Event Viewer (*eventvwr.exe*) for the detailed logs!
Happy coding!