Dynamic ports via code in runtime.
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
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 connection with YARP i need to ability to open/close ports in runtime via code.
Issue that i have custom handlers for ListenAnyIP.
I do
```cs
builder.WebHost.UseKestrel(options =>
{
options.ListenAnyIP(80, lo => {...});
options.ListenAnyIP(443, lo => {...});
});
```
I found that this is possible via configuration, but that not compatible with manual settings for kestrel.
### Describe the solution you'd like
Something like request IListenManager from DI
then call
```cs
manager.StopListenAnyIP(80);
manager.StartListenAnyIP(80, (ListenOptions lo) => {...});//usual setup of port goes here
```
Something like this.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.