【问题标题】:When trying to "start" a Windows service I get an error尝试“启动”Windows 服务时出现错误
【发布时间】:2012-04-04 18:43:14
【问题描述】:

我正在按照 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...

非常感谢您的帮助。

【问题讨论】:

    标签: .net wcf service netnamedpipebinding


    【解决方案1】:

    正如它在错误的第一行中所说的那样

    HTTP 无法注册 URL http://+:8080/ProductsService/Service.svc/,因为另一个应用程序正在使用 TCP 端口 8080。

    您正尝试在端口 8080 上注册,但端口 8080 正被另一个应用程序使用。尝试更改端口号,直到找到未使用的端口号。

    【讨论】:

      【解决方案2】:

      另一个服务正在使用该端口

      试试 8084

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-06-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多