C#C
C#3y ago
camel

❔ Configure Web Host Kestrel

I have the following segment in my
appsettings.json
and it works like a charm for http and http2 (for grpc).

"Kestrel": {
    "Endpoints": {
        "Http": {
            "Url": "http://localhost:49098",
            "Protocols": "Http1AndHttp2"
        },
        "gRPC": {
            "Url": "http://localhost:49099",
            "Protocols": "Http2"
        }
    }
}


How do I write this in my
Program.cs
?

builder.WebHost.UseKestrel(kestrelServerOptions =>
{
    //...
});
Was this page helpful?