In an ASP.NET Core web service application, is there a way to determine the base URL and PORT being used once the server starts up?
I want to log this to as part of our standard service startup sequence for admin and support staff.
Most of the time it will be port 80, but not always and when debugging with IIS Express a (random-ish) port number is used.
I did discover ServerAddressesFeature and when I get at that the URL sort of looks OK but the port is different to the actual port being used.
i.e. IIS Express says its using port 27988 but the port seen in the server addresses feature class is 27750 !
Any help is much appreciated.
NOTE: This information is required at app startup, it is not being determined during the execution of a controller/request.