我正在按照 John Sharp 的“Windows Communication Foundation 4”中的示例进行操作。第 88-89 页显示了如何注册和启动服务。我的服务没有启动。
我需要说我无法在我自己的主机中使用 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...
非常感谢您的帮助。