Last active
November 29, 2021 16:29
-
-
Save doronguttman/ba1747c74694cfa141a1db5e119e913f to your computer and use it in GitHub Desktop.
Get First Kestrel Endpoint Address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Type: Microsoft.AspNetCore.Hosting.Server.Features.IServerAddressesFeature | |
// Assembly: Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 | |
// using Microsoft.AspNetCore.Hosting.Server.Features; | |
public void Configure(IApplicationBuilder app) | |
{ | |
var address = app.ServerFeatures | |
.Select(i => i.Value) | |
.OfType<IServerAddressesFeature>() | |
.SelectMany(f => f.Addresses) | |
.First(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment