我已经在这个问题上被困了好几天了。我知道wcf的基础知识。管理现有代码并遇到这个问题。我一直在我的几个客户端托管应用程序没有任何问题,并且wcf客户端站点已经能够与服务进行通信,除了这个wcf服务是一个非启动器。
这是一个IIS托管的wcf服务。我们有CA颁发的证书。我能够在客户端验证证书,因此相信它是在mmc的Trusted Publishers下正确导入的。
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>
我还安装了服务跟踪查看器,但是没有显示任何错误。
答案 0 :(得分:0)
问题是因为互联网连接速度缓慢,并且在验证证书期间,它在初始握手过程中超时。