我试图通过UAT环境调用webservice时遇到错误 . 但是在我当地它运作正常 . 我看到一些评论,因为它可能是由于虚拟证书但无法得到答案所以在此发布 . 我也是WCF的初学者 . 请让我知道如何解决这个问题 .
如果我信任所有人,会对 生产环境 产生什么影响
//Trust all certificates
System.Net.ServicePointManager.ServerCertificateValidationCallback =
((sender, certificate, chain, sslPolicyErrors) => true);
错误说 - System.ServiceModel.Security.SecurityNegotiationException:无法为具有权限的SSL / TLS安全通道 Build 信任关系 . ---> System.Net.WebException:底层连接已关闭:无法为SSL / TLS安全通道 Build 信任关系 . ---> System.Security.Authentication.AuthenticationException:根据验证程序,远程证书无效 .
绑定是
<basicHttpBinding>
<binding name="GLEditServiceSOAP" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
也想知道它是如何在我的localhost上工作的 .
1 回答
你可以参考这篇文章here . 如帖子中所述,如果您信任具有SSL的URL或者所有组件都托管在公司的Intranet内,则在证书验证中返回始终为True是安全的 .