Questions tagged [kestrel-http-server]

Kestrel is a HTTP server that is built-in to ASP.NET Core.

Kestrel is an open-source web server based on libuv and developed by Microsoft. The project home is on GitHub.

822 questions
11
votes
4 answers

Running multiple ASP.NET Core (3.1x/Latest) websites on port 80 with Kestrel

I'm using (ASP).NET Core (3.1x), C#, Blazor and Microsoft Kestrel Web-server and I'm wondering if I can run 2 or 3 different websites (domain names) on one Kestrel instance and on port 80. I would really like to use Kestrel as the only web server…
Jaap
  • 665
  • 1
  • 8
  • 19
11
votes
1 answer

X-Original-For header: what's its purpose?

While logging the HTTP headers that are received by my web app (which is behind a load balancer + firewall), I've noticed that I'm receiving the X-Original-For and X-Original-Proto headers (besides the traditional X-Forwared-XXX headers). What's…
Luis Abreu
  • 4,008
  • 9
  • 34
  • 63
11
votes
2 answers

Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2ConnectionErrorException

I have the following exception Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2ConnectionErrorException: HTTP/2 connection error (PROTOCOL_ERROR): Invalid HTTP/2 connection preface. I will describe my conditions. I have very…
Aleksej_Shherbak
  • 2,757
  • 5
  • 34
  • 71
11
votes
3 answers

Make ASP.NET Core server (Kestrel) case sensitive on Windows

ASP.NET Core apps running in Linux containers use a case sensitive file system, which means that the CSS and JS file references must be case-correct. However, Windows file system is not case sensitive. Therefore during development you can have CSS…
Paymon
  • 1,173
  • 1
  • 9
  • 26
11
votes
2 answers

Determine port Kestrel binded to

I'm writing a simple ASP.NET Core service using ASP.NET Core empty (web) template. By default, it binds to port 5000 but I would like it to bind to a random available port on the system. I can do so by modifying BuildWebHost to: public static…
Regent
  • 5,502
  • 3
  • 33
  • 59
11
votes
3 answers

Will IIS recycle the asp.net core process?

I need to run long running background tasks in my asp.net core application. I know of Azure Webjobs and other out of process techniques but I'd rather keep the solution simple and runs those tasks directly in the asp.net core process. I use Kestrel…
Clement
  • 3,990
  • 4
  • 43
  • 44
10
votes
1 answer

How can I change Kestrel (AspNetCore) listening port by environment variables in netcore3.1

I have aspnetcore3.1 project, and I want to set custom port for Kestrel (other than default 5000). I can possibly do it in Program.cs by adding Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { …
10
votes
1 answer

Cant find self signed trusted certificate used by Kestrel

I have a very basic self-hosted .NET core 2.1 application with the following configuration: public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() …
10
votes
0 answers

ASP.NET Core websites gets unresponsive

I have two sites running on my development machine for the last 8 months or so. Both sites use ASP.NET Core, and both are running on Kestrel behind IIS. During the last couple of weeks, the sites have become a headache. After building or restarting…
Nicky
  • 428
  • 3
  • 13
10
votes
3 answers

Kestrel Server: How to bind different ports to different controllers?

Is there a way in Kestrel to listen on 2 ports, e.g. 80 and 81, and specify different controllers for each port? The scenario I have is that there are 2 controllers, one for the end user requests that would need token based authentication, and…
schauhan
  • 531
  • 1
  • 5
  • 17
10
votes
0 answers

How to bind route to specific port in asp.net-core / Kestrel

In asp.net web api it was possible to map a route with a specific port to a controller like so: public void Run1() { HttpConfiguration config = new HttpConfiguration(); ... config.Routes.MapHttpRoute( name: "Controller1", …
Jeldrik
  • 1,377
  • 1
  • 10
  • 35
10
votes
1 answer

How to configure Kestrel urls in startup class

I am trying to figure out the proper way to modify the URL(s) that kestrel listens on from the Startup class constructor. Update: In addition to the answer below, I've come to understand that Startup class isn't used to configure Kestrel in the way…
Steve
  • 596
  • 2
  • 7
  • 20
10
votes
1 answer

How to disable Keep-Alive in IIS conditionally?

My situation is the following: I have an ASP.NET Core REST API using Kestrel reverse proxied over IIS (through AspNetCoreModule). On a special endpoint (required by a hardware device) I send a 'Connection: close'-HTTP header. On all other endpoints…
10
votes
2 answers

Is it possible to use ASP.NET Core Web API without IIS in a Windows Desktop application?

Currently I'm trying to find a way to build a desktop app that hosts a browser window and uses JavaScript to communicate with a local ASP.NET Core Web API as the "backend": All my searches lead to the suggestion that I should use IIS Express web…
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
10
votes
1 answer

How do you set up Kestrel debugging with Visual Studio Code on Windows?

I've had a difficult time finding instructions on how to set up debugging within Visual Studio Code on Windows (10 if it matters) using the launch.json file. Can someone define how to set this up?
Kevin Kraus
  • 283
  • 1
  • 2
  • 11