Owin自托管 - 无法监听前缀'http:// localhost:12345 /',因为它与机器上的现有注册冲突 [英] Owin self-host - Failed to listen on prefix 'http://localhost:12345/' because it conflicts with an existing registration on the machine
问题描述
我正在尝试自我托管一个简单的WebAPI:
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:
无法收听前缀' http://myhost.mymachine.me:12345/ '因为它与机器上的现有注册冲突
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?
推荐答案
如果它抱怨现有注册,那是因为该端口上正在运行其他东西。如果它第一次工作,那么听起来你的第一个程序实例仍在运行。
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.
这篇关于Owin自托管 - 无法监听前缀'http:// localhost:12345 /',因为它与机器上的现有注册冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!