Owin self-host - Could not listen to the prefix 'http: // localhost: 12345 /', because it conflicts with existing registration on the machine

I am trying to install a simple WebAPI myself:

public class AccountViewApplication { protected IDisposable WebApplication; public void Start() { WebApplication = WebApp.Start<WebPipeline>("http://myhost.mymachine.me:12345"); new AccountViewApplication().Start(); } public void Stop() { WebApplication.Dispose(); } } 

The first time I run this, it starts to listen just fine, but the next time I try, I get the following:

Could not listen to the prefix ' http://myhost.mymachine.me:12345/ ' because it conflicts with existing registration on the computer

What can I do to listen every time, rather than complain about an existing reservation?

+7
owin katana self-hosting
source share
2 answers

If he complains about the existing registration, this is due to the fact that something else works on this port. If this worked for the first time, then it looks like your first copy of the program is still running.

Go to the task manager for your program name and see if it is alive.

+2
source

check solution

1- open cmd and "netstat -aon" look for the port in the local address column after the search check PID it is possible to use the port with other products

2- maybe call this line two or more times WebApplication = WebApp.Start (" http://myhost.mymachine.me:12345 ");

3-try this

" http://myhost.mymachine.me:12345/user:everyone "

0
source

All Articles