Add option to force LocalhostListenOptions throw when bind to v4 or v6 loopback fail
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
In our case the port we want to listen to was used by other app, which only use the port in ipv4 for connect remote server.
Result in kestrel fail to bind ipv4 silently (only logs output, no exception throw), and user can't connect to our app service while app report everything is normal.
### Describe the solution you'd like
Add a option for `ListenLocalhost` extension method and `LocalhostListenOptions` to froce `LocalhostListenOptions` throw exception when bind to v4 or v6 fail, instead of fail sliently.
Maybe a enum like:
- AlwaysThrowOnBindFail
- ThrowOnBindV4Fail (pure v6 environment)
- ThrowOnBindV6Fail (in case of ipv6 isn't available or disable in user environment)
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.