gpt4 book ai didi

c# - 发生 SocketException 现有连接被远程主机强行关闭 ErrorCode=10054

转载 作者:太空宇宙 更新时间:2023-11-03 14:48:54 26 4
gpt4 key购买 nike

我已经在这个问题上卡住了好几天了。我知道 wcf 的基础知识。管理现有代码并遇到了这个问题。我一直在我的几个客户端中托管应用程序,没有任何问题,并且 wcf 客户端站点已经能够与服务通信,除了这个 wcf 服务是一个非启动器。

这是 IIS 托管的 wcf 服务。我们有 CA 颁发的证书。我能够在客户端验证证书,因此相信它是在 mmc 的受信任发布者下正确导入的。

wcf 客户端应用程序能够实例化 wcf 对象。但是,当我调用一个仅返回“true”的简单函数(以确认 wcfobject 可访问)时,它会抛出异常。

        EndpointAddress myEndpointAdd = new EndpointAddress(new Uri(practiceUrl),
EndpointIdentity.CreateDnsIdentity(dnsIdentity));
DataServiceClient wcfObject = new DataServiceClient("wsHttpEndPoint", myEndpointAdd);

((WSHttpBinding)wcfObject.ChannelFactory.Endpoint.Binding).MaxReceivedMessageSize = 2147483647;
((WSHttpBinding)wcfObject.ChannelFactory.Endpoint.Binding).ReaderQuotas.MaxArrayLength = 2147483647;
((WSHttpBinding)wcfObject.ChannelFactory.Endpoint.Binding).MaxBufferPoolSize = 2147483647;
((WSHttpBinding)wcfObject.ChannelFactory.Endpoint.Binding).OpenTimeout = TimeSpan.FromMinutes(10);
((WSHttpBinding)wcfObject.ChannelFactory.Endpoint.Binding).ReceiveTimeout = TimeSpan.FromMinutes(5);
((WSHttpBinding)wcfObject.ChannelFactory.Endpoint.Binding).SendTimeout = TimeSpan.FromMinutes(10);
((WSHttpBinding)wcfObject.ChannelFactory.Endpoint.Binding).ReaderQuotas.MaxBytesPerRead = 2147483647;
((WSHttpBinding)wcfObject.ChannelFactory.Endpoint.Binding).ReaderQuotas.MaxDepth = 2147483647;
((WSHttpBinding)wcfObject.ChannelFactory.Endpoint.Binding).ReaderQuotas.MaxStringContentLength = 2147483647;

wcfObject.IsClientRunning(); //service should return true if all goes well

客户端已经打开防火墙到我的机器 IP,从我的浏览器我可以看到客户端安装的服务的登陆页面。

<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingSettings" receiveTimeout="00:20:00" closeTimeout="00:20:00" openTimeout="00:20:00" sendTimeout="00:20:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Message">
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>

我还安装了服务跟踪查看器,但没有显示任何错误。 TraceLog

最佳答案

问题是因为互联网连接速度慢,并且在验证证书期间的初始握手过程中超时。

关于c# - 发生 SocketException 现有连接被远程主机强行关闭 ErrorCode=10054,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36187689/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com