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

run-host.bat

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:

<sites>
....<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" />
        </application>
        <bindings>
          <binding protocol="http" bindingInformation="*:56570:localhost" />
          <binding pro