Skip to content

Add option to force LocalhostListenOptions throw when bind to v4 or v6 loopback fail #66128

@Misaka-L

Description

@Misaka-L

Is there an existing issue for this?

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions