NoEscape
NoEscape

Reputation: 211

Running ASP.NET core web app from .net core console app

Let's say I've created a solution with 2 projects: ASP.NET Core Web Application and .NET Core Console App.

Is there a way to reference and run web application from console app?

Specifically:

How do I publish a .Net Core console app to a web server running IIS?

Upvotes: 2

Views: 2182

Answers (1)

galdin
galdin

Reputation: 14074

ASP.NET Core apps are console apps. Run the following in the command prompt in the project directory:

dotnet publish -o publish-output

This will generate the shared publish files in a publish-output directory. You may now run it with:

dotnet project-name.dll

Once you run it, it will accept requests on a configured port. IIS (or any other server) can now be configured to work as a reverse proxy. You'd typically create a website in IIS, and move the files from the publish-output to the website's IIS directory and configure IIS to act as a reverse proxy to it.

Follow the instructions at Microsoft Docs here.

Upvotes: 1

Related Questions