Home:ALL Converter>Connect directly to Kestrel behind IIS

Connect directly to Kestrel behind IIS

Ask Time:2018-05-31T04:06:57         Author:Floris

Json Formatter

I have a web app made in C# using asp.net core 2.0. This app is hosted in IIS, as this is the recommended way to expose it to the internet.

I am now making some services hosted in the same local lan as the webapp, which need to connect to the above webappp. I can connect to the public iis server which of course works. However, would it also be possible to directly connect to the Kestrel server managed by IIS? So instead of connecting to public_ip/somewhere, connect to kestrel-local-ip:port/somewhere. The advantages would be:

  • avoid an extra hop
  • the kestrel app is still hosted and managed by IIS, so no worrying about self-hosting/management.

Reading the documentation here: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/aspnet-core-module?view=aspnetcore-2.1 it states: "Additional checks are performed, and requests that don't originate from the module are rejected.". Reading the Github repro, this seems to be an HTTP header called "MS-ASPNETCORE-TOKEN".

So is this scenario possible somehow? To connect directly to IIS but ALSO to kestrel directly?

If it is possible, should I do this? The performance gains seem immense as I have a lot of small requests which Kestrel can handle really well.

Author:Floris,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50612625/connect-directly-to-kestrel-behind-iis
yy