1

When I create a new project in Visual Studio using the "ASP Net Core Web Application" template, and press F5 (or click the "IIS Express" debug button), what exactly is happening in the background in terms of web servers?

  1. Does it start an IIS webserver as reverse proxy with a kestrel application server which serves my app (I guess so)?
  2. Can I / How can I run the app without IIS (only using Kestrel)?
  3. Why can't I access my data when I use localhost:5000 (default Kestrel port) instead of localhost:63152 (IIS port)? Shouldn't I be able to access Kestrel directly, even if IIS serves as a proxy?
  4. When I dockerize the app with the default container mcr.microsoft.com/dotnet/core/sdk:3.1 and run it, does this also start an IIS + Kestrel inside the container?
Tobias von Falkenhayn
  • 1,355
  • 5
  • 26
  • 59
  • 1
    You asked too many questions together. Links like https://stackoverflow.com/questions/35639205/what-is-kestrel-vs-iis-express/46878663#46878663 and https://blog.lextudio.com/how-visual-studio-launches-iis-express-to-debug-asp-net-core-apps-d7fd3677e3c3 might help. In general, Kestrel is good enough to be on its own, without IIS (like on Docker container), but unfortunately Microsoft leaves IIS/IIS Express in several places (like in VS) by default (but you can switch fully to Kestrel only). – Lex Li Jul 23 '20 at 15:43

1 Answers1

3
  1. The IIS express will run like you say as a proxy in front of the kestrel process. In earlier versions of .Net IIS would also run the application but now that is handled by kestrel.

  2. In your project you will have (else you can create it) a folder called Properties with a file called launchSettings.json where you can specify profiles for how you want to run your project. In most cases this will be created when you create a new project in VS. Here you can add or modify profiles.

To run your project without IIS express your profile should have "commandName": "Project". You can then choose what profile to run using the interface of VS.

  1. Im not entirely sure why you cant access this.

  2. That depends on your docker file but if you use the standard file it will not use IIS.

Achtung
  • 682
  • 3
  • 16
  • Thanks for your answer. Maybe IIS acts as some If I use a default docker file mcr.microsoft.com/dotnet/core/sdk:3.1 does that mean it will only run kestrel inside it? :) – Tobias von Falkenhayn Jul 23 '20 at 15:45
  • Kestrel is included in you .net application so if you run your application it will run kestrel. If you would want to use IIS as a proxy that would have to be configured in your docker file. IIS express will only ever be run by Visual studio, so if you run it from docker it will need a real installation of IIS. The following seems to be a docker file for something like that: https://gist.github.com/artisticcheese/e4776f420f1d0088d87335284b103cce – Achtung Jul 23 '20 at 15:50