0

I am using ASP.NET Core with VS 2017. I am wondering if the applications when being built create both IIS Express and Kestrel? Or just one of them? I am talking just locally.

bluish
  • 26,356
  • 27
  • 122
  • 180
Unknown developer
  • 5,414
  • 13
  • 52
  • 100

2 Answers2

8

If you look your launchSettings.json file under Properties section. you'll see your launch profiles. For example:

...
"profiles": {
"IIS Express": {
  "commandName": "IISExpress",
  "launchBrowser": true,
  "launchUrl": "https://localhost:44376/",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
},
"WebApplication1": {
  "commandName": "Project",
  "launchBrowser": true,
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  },
  "applicationUrl": "http://localhost:50768/"
}
}
...

These profiles specify how your app will run with what settings and environment variables. You can have as many launch profiles as you want with different settings.

The commandName can have one these:

  • IIS

  • IISExpress

  • Project (which uses Kestrel)

You can change your launching profile with the dropdown next to the Run button in VS or with the following command:

dotnet run --lauch-profile <profile_name>

Kestrel is not recommended for production but is OK for development. Even if you choose IIS or IISExpress, Kestrel will always be used (unless you use HTTP.sys which is only available for Windows). So no matter what web server you use in production (IIS, nginx, Apache) or in development, they will always pass the request to Kestrel after doing their job on the request.

Sasan
  • 3,840
  • 1
  • 21
  • 34
1

Your question is not clear at all. Kestrel is always used. IIS Express acts as a reverse proxy for Krestrel. However, nothing is "created" in this regard. When the core app is built, you simply end up with the app itself. The functionality to host it is external. You can build as a self-hosted application, in which case you'll get an executable instead of a DLL. However, that's never going to be part of debugging or running locally in Visual Studio: your app will always be built as a DLL.

In older revisions of Visual Studio 2017, it used to be possible to run/debug your app as either self-hosted or in IIS Express, if that's what you're talking about. However, that option has since been removed. Run/debug always uses IIS Express, now.

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444
  • 2
    It's still possible to run/debug an app without IIS Express (or using the full IIS). It can be configured in project Properties -> Debug or by manually editing launchSettings.json – Michał Dudak Mar 08 '18 at 17:51
  • Following your explanation, I've come up with this question: "Is it possible to talk directly to the Kestrel instance which is behind IIS Express"? Or a related question: On what port does Kestrel talk to IIS Express? – Hans Jan 17 '20 at 22:47
  • It's not a port. It's run as an IIS module. There's no way to talk to Kestrel. – Chris Pratt Jan 17 '20 at 23:07
  • How about this: `The following characteristics apply when hosting in-process: IIS HTTP Server (IISHttpServer) is used instead of Kestrel server` See: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.1#in-process-hosting-model – Hans Jan 18 '20 at 07:24