Actually I understand that IIS Express is lightweight development server. From the other side "dotnet run" runs the application as a console application and binds it to random port.
But what is the actual difference? I can launch big enterprise application by IIS Express
and by "dotnet run"
and both cases work perfectly.
Till now all the difference I see is that IIS Express
adds icon to the taskbar and dotnet run
allows to see console output. But those are minor differences. It should be some global ones why IIS Express is so widespread nowadays.
Some structurization can be found here: ASP.NET Core launch settings: IIS Express, IIS, Project, Executable. But it still doesn't explain the difference.
dotnet run
will use the embedded Kestrel server. IIS Express will use IIS Express as a reverse proxy which calls Kestrel behind the scenes. In either case a server is hosting your app.
You can toggle your local server choice by adjusting the run configuration. IIS Express will use...IIS Express. But if you instead select the project (in the case of the screenshot, it's titled weatherapi
) it will use Kestrel instead. You'll see a command prompt pop up, showing some basic configuration data (assuming you haven't changed the default logging output). The first time it's run, you may have to accept/install the localhost TLS certificate, so that you don't run into TLS errors.
One way of confirming which process you are using, is to call get-process
in powershell, along with either iisexpress
or {nameOfProject}
More info from the docs https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/?view=aspnetcore-3.1&tabs=windows
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With