【发布时间】:2016-03-23 20:04:31
【问题描述】:
我已经在这个问题上卡住了好几天了。我知道 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>
我还安装了服务跟踪查看器,但没有显示任何错误。
【问题讨论】: