2014-10-20 115 views
4

我試圖啓動一個使用端口8081的服務。該服務在啓動後立即停止。我看看事件查看器,我看到:HTTP無法註冊URL

Service cannot be started. System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL https:// +:8081/api/. Another application has already registered this URL with HTTP.SYS. ---> System.Net.HttpListenerException: Failed to listen on prefix 'https:// +:8081/api/' because it conflicts with an existing registration on the machine.

我試着用netsh的註冊網址,但它說該文件已經存在,但我不能刪除保留,它不會出現在預訂名單(netsh的HTTP顯示urlacl)。

netsh http add urlacl url=http:// +:8081/api/ user=\Everyone 

Url reservation add failed, Error: 183 Cannot create a file when that file already exists.

netsh http delete urlacl url=https:// +:8081/api/ 

URL reservation delete failed, Error: 2 The system cannot find the file specified.

有什麼我可以做些什麼來解決這個問題?

注意:該服務在其他機器上運行良好。

回答

4

您的刪除命令在add命令中使用的地址與http相反。刪除's',它應該工作。

+0

向上投票這個答案B/C我也有一個錯字在我試圖刪除的URL中 - 呃... – 2015-09-14 20:43:59

1

請勿使用「+」。試試這個:

netsh http add urlacl url=http://0.0.0.0:8081/api/ user=\Everyone 
1

delete命令需要一個精確的匹配。使用show命令可以發現存在哪些註冊,可能將其管道化爲文件或根據您的需要將其grep爲端口號,例如,

netsh http show urlacl > d:\tmp\out.txt 

然後你就可以高高興興地運行

netsh http add urlacl url=theExactRegisteredUrl 

在我來說,我已經錯過了尾隨斜線它已登記