Graeme
Graeme

Reputation: 2667

How to run ASP.NET Core site under IIS

I've studied the docs on how to do this but am still not understanding: I've published my site from Visual Studio and can run the site from the command prompt using the command:

dotnet MyDotnetCoreApp.dll

That tells me the app started on http://localhost:5000 and I can browse to it just fine.

But how do I get IIS to start the app though so that I can go to the normal port 80? The web.config has the correct entry:

<aspNetCore processPath="dotnet" arguments=".\MyDotnetCoreApp.dll" .... />

All I get is 500 An error occurred while starting the application.

Must be missing some simple step. Thanks in advance.

Upvotes: 2

Views: 2343

Answers (1)

Set
Set

Reputation: 49809

Actually in your case you are not running using IIS, but using Kestrel HTTP Server. You can read about Kestrel hosting configuration (and find how to change listening port) in this SO answer.

In case if you need to run under IIS (that is still publish option #1 on Windows, despite IIS is acting now merely as a reverse proxy and the application itself runs as a separate process using the Kestrel HTTP server), you may find Running ASP.Net Core applications with IIS article very useful, as it explains not just how to make ASP.NET Core works with IIS, but also "what’s really happening, why it’s happening and how the blocks fit together"

Upvotes: 1

Related Questions