【发布时间】:2020-08-25 17:24:34
【问题描述】:
对于以下所有用例,我都遇到过这种情况。 除了情况 3 正常且一般,其余情况需要解决
以下这些服务运行时没有任何错误:
- Net.Msmq 侦听器适配器
- Net.Pipe 侦听器适配器
- Net.Tcp 侦听器适配器
- Net.Tcp 端口共享服务
- Windows 进程激活服务
还启用了协议:net.tcp,http
在调用 WCF 编写的服务时从命令行或通过应用程序:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools>svcutil net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex
案例 1:
Could not connect to net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex. The connection attempt lasted for a time span of 00:00:04.0935290. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:808. No connection could be made because the target machine actively refused it 127.0.0.1:808案例 2:
There was no endpoint listening at net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.案例 3:
The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:04:59.9843875'. An existing connection was forcibly closed by the remote host
案例 2 的事件日志:
An error occurred in the Activation Service 'NetTcpActivator' of the protocol 'net.tcp' while trying to listen for the site '1', thus the protocol is disabled for the site temporarily. See the exception message for more details.
URL: WeakWildcard:net.tcp://username.domainname.com/
Status: FailedToListen
Exception: System.ServiceModel.AddressAlreadyInUseException: There is already a listener on IP endpoint 0.0.0.0:808. This could happen if there is another application already listening on this endpoint or if you have multiple service endpoints in your service host with the same IP endpoint but with incompatible binding configurations. ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.ServiceModel.Channels.SocketConnectionListener.Listen()
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.SocketConnectionListener.Listen()
at System.ServiceModel.Activation.TransportListener.Go(IConnectionListener connectionListener)
at System.ServiceModel.Activation.TransportListener..ctor(IPEndPoint endPoint)
at System.ServiceModel.Activation.TransportListener.Listen(IPEndPoint endPoint)
at System.ServiceModel.Activation.RoutingTable.TcpStart(MessageQueue messageQueue, BaseUriWithWildcard path)
at System.ServiceModel.Activation.MessageQueue.Register(BaseUriWithWildcard path)
at System.ServiceModel.Activation.ListenerAdapter.RegisterBindings(IActivatedMessageQueue queue, Int32 siteId, String[] bindings, String path)
Process Name: SMSvcHost
Process ID: 4608
我们应该如何实现默认情况下进入案例3,无论何时何地,例如引导和重新启动系统?
【问题讨论】: