I'm using ASP.NET Core 5, and Swagger. I know how to use Swagger, and it works properly.
Swagger is served on foo:5001/swagger
- but I need to determine that URL programmatically at runtime.
How can I do that?
I already tried:
Getting it by injecting
IEnumerable<EndpointDataSource>
into some helper/controller class, but that shows me all routes EXCEPT swagger's.Getting it while setting up endpoint routing and inspecting
IEndpointRouteBuilder
, but once again it shows me all routes EXCEPT swagger's.