Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I would like to start and stop our application on demand, without exiting the process. Code would be similar like:
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseHttpSys();
builder.Services.AddControllers();
var app = builder.Build();
await app.StartAsync();
await app.StopAsync();
// Something here
await app.StartAsync();
However, with http.sys this gives an exception: Microsoft.AspNetCore.Server.HttpSys.HttpSysException: 'The prefix 'http://localhost:5074/' is already registered.'
.
Minimum testcase: WebApplication2.zip
Is there any way to restart the app or a workaround to make this work?
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.102
Anything else?
No response