I have the following OWIN implementation to run my functional tests on CI
protected const string Url = "http://localhost:8785";
private static IDisposable _app;
Establish context = () => _app = WebApp.Start(Url, a =>
{
a.Use(typeof(MockIdentityMiddleware));
new Startup().Configuration(a);
});
Cleanup after = () => _app.Dispose();
But when it runs I get the following stack trace:
System.Net.HttpListenerException: Failed to listen on prefix 'http://localhost:8785/' because it conflicts with an existing registration on the machine.
I want to remove the registration for that port programmatically so I don't have to worry anymore but not sure how to do it with Owin.