【发布时间】:2019-12-28 09:53:36
【问题描述】:
连接到 WCF 服务时出现错误 它是一个工作代码我刚刚更改了服务器 Window Service 中托管的 WCF 服务 Windows 服务正在运行
我有两个服务器 1. Server_1 与 Windows Server 2012 R2 Standard 2. Server_2 与 Windows Server 2008 R2 Enterprise
从 Server_2 调用工作正常 但我从 Server_1 得到以下错误
套接字连接被中止。这可能是由于处理您的消息时出错或远程主机超出接收超时,或者是潜在的网络资源问题引起的。本地套接字超时为“00:30:00”。
2019 年 8 月 23 日 15:22:33 Process_Word_Document 2019 年 8 月 23 日 15:22:33 2019 年 8 月 23 日 15:22:33 szWord_Operation_Ip : 192.168.1.126 8/23/2019 15:22:33net.tcp://192.168.1.126/CalcService 2019 年 8 月 23 日 15:22:33 频道 8/23/2019 15:22:33 错误:套接字连接被中止。这可能是由于处理您的消息时出错或远程主机超出接收超时,或者是潜在的网络资源问题引起的。本地套接字超时为“00:29:59.9687487”。 2019 年 8 月 23 日 15:22:33 错误:异常类型 System.ServiceModel.CommunicationException 异常消息:套接字连接已中止。这可能是由于处理您的消息时出错或远程主机超出接收超时,或者是潜在的网络资源问题引起的。本地套接字超时为“00:29:59.9687487”。堆栈跟踪: ---开始内部异常--- 异常类型 System.Net.Sockets.SocketException 异常消息:远程主机强制关闭现有连接 堆栈跟踪:在 System.Net.Sockets.Socket.Receive(Byte[] 缓冲区,Int32 偏移量,Int32 大小,SocketFlags socketFlags) 在 System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] 缓冲区,Int32 偏移量,Int32 大小,TimeSpan 超时,布尔关闭) ---END内部异常选中的 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;
【问题讨论】:
标签: c# wcf windows-server-2012