连接到WCF服务时出现错误 它是一个有效的代码,我刚刚更改了服务器 窗口服务中托管的WCF服务 Windows服务正在运行
我有两个服务器 1. Windows Server 2012 R2 Standard的Server_1 2. Windows Server 2008 R2 Enterprise的Server_2
从Server_2呼叫正常 但是我从Server_1处遇到错误
套接字连接已中止。这可能是由于处理您的消息时出错,远程主机超出了接收超时或潜在的网络资源问题引起的。本地套接字超时为“ 00:30:00”。
8/23/2019 15:22:33 Process_Word_Document 8/23/2019 15:22:33 8/23/2019 15:22:33 szWord_Operation_Ip : 192.168.1.126 8/23/2019 15:22:33net.tcp://192.168.1.126/CalcService 8/23/2019 15:22:33 Channel 8/23/2019 15:22:33 eRROR : 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:29:59.9687487'. 8/23/2019 15:22:33 eRROR : Exception type System.ServiceModel.CommunicationException Exception message: 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:29:59.9687487'. Stack trace: ---BEGIN InnerException--- Exception type System.Net.Sockets.SocketException Exception message: An existing connection was forcibly closed by the remote host Stack trace: at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing) ---END Inner Exception
选中Windows防火墙已关闭
NetTcpBinding _binding = new NetTcpBinding();
_binding.Security.Mode = SecurityMode.None;
_binding.SendTimeout = new TimeSpan(0, 10, 0);
_binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
_binding.OpenTimeout = new TimeSpan(0, 10, 0);
_binding.CloseTimeout = new TimeSpan(0, 10, 0);
EndpointAddress _endpoint = new EndpointAddress("net.tcp://" + szWord_Operation_Ip + "/CalcService");
Channel = new ChannelFactory<Process_Word_Document.ICalcService>(_binding, _endpoint);
Process_Word_Document.ICalcService proxy = Channel.CreateChannel();
proxy.Update_Document_Properties(szFilePath);
Channel.Close();
Channel.Abort();
Channel = null;