C
C#2y ago
Hugh

❔ Finding which port a WebApplication has bound to

I have a .NET web application, and I'm telling it that it can pick any port that it likes (by giving it a URL to bind to of http://127.0.0.1:0). I then want to find out what port it has picked, and I can't figure out how to do this. All of the search results that I've found have possibly been outdated, as none of them have worked. How would I go about doing this?
2 Replies
Hugh
HughOP2y ago
Ah - I just found this further down my search results - this has done the trick for me: https://nodogmablog.bryanhogan.net/2022/01/programmatically-determine-what-ports-kestrel-is-running-on/
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server