我的Windows使用WCF服务主机侦听TCP端口61000上的连接。当我尝试启动服务时,我会得到以下错误:
Service cannot be started. System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL http://+:61000/ because TCP port 61000 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.AddAll()
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.HttpChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
at...
一个快速的netstat -a
显示在端口61000上没有任何监听内容。我还在网上找到了几个提到使用netstat
的帖子,但是该服务运行的帐户具有管理员权限,所以这不应该是必要的。
关于我为什么会收到这条信息还有什么其他的想法吗?
此服务运行在64位Windows 2008 R2标准上.
发布于 2012-06-15 18:37:57
如果程序关闭时端口上有一个打开的连接,而TCP没有完成4路关闭握手,则套接字将保持“半关闭”状态,直到超时结束(即使程序已终止),并将阻止您再次打开该端口。不同的实现有不同的超时,通常从1/2秒到2分钟不等。
https://serverfault.com/questions/235844
复制相似问题