2012-04-04 73 views
0

我正在關注John Sharp的「Windows Communication Foundation 4」中的示例。第88-89頁顯示瞭如何註冊和啓動服務。我的服務無法啓動。當試圖「啓動」Windows服務時,出現錯誤

我必須說,在我自己的主機使用的net.tcp我不能運行該服務,因爲它抱怨上當受騙的端口,則應當使用了NamedPipes。

在應用程序日誌中的錯誤是

Service cannot be started. System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL http://+:8080/ProductsService/Service.svc/ because TCP port 8080 is being used by another application. ---> System.Net.HttpListenerException: The process cannot access the file because it is being used by another process 
    at System.Net.HttpListener.AddAllPrefixes() 
    at System.Net.HttpListener.Start() 
    at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() 
    --- End of inner exception stack trace --- 
    at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() 
    at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener) 
    at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback) 
    at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.Communicat... 

你的幫助是非常讚賞。

回答

2

另一項服務正在使用該端口

嘗試8084

4

因爲它在錯誤的第一行

HTTP不能註冊網址http://+:8080/ProductsService/Service.svc/說,由於TCP端口8080正在使用另一個應用。

您試圖在端口8080上註冊,但端口8080正在被另一個應用程序使用。嘗試更改端口號,直到找到一個未被使用的端口號。

相關問題