2012-04-04 117 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正在被另一个应用程序使用。尝试更改端口号,直到找到一个未被使用的端口号。

相关问题