Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm trying to self-host a simple WebAPI:

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 that I try - I get this:

Failed to listen on prefix 'http://myhost.mymachine.me:12345/' because it conflicts with an existing registration on the machine

What can I do to make it listen every time, and not complain about an existing reservation?

like image 295
Eugene Goldberg Avatar asked Oct 16 '14 13:10

Eugene Goldberg


1 Answers

If it's complaining about an existing registration, it's because something else is running on that port. If it worked the first time, then it sounds like your first instance of the program is still running.

Check in Task Manager for your program name and see if it's still alive.

like image 154
TomDestry Avatar answered Sep 22 '22 17:09

TomDestry