BasicHTTP绑定和信任关系

时间:2014-08-15 18:01:36

标签: wcf security ssl

我正在尝试连接到Web服务。此服务的证书位于服务器上。我正在创建这样的服务:

BasicHttpBinding basicbinding = new BasicHttpBinding();

// Transport needed for HTTPS according to msft
basicbinding.Security.Mode = BasicHttpSecurityMode.Transport;

endPoint = new Client(basicbinding, new EndpointAddress(myURL);

当我尝试从服务中获取数据时(endPoint.getSomeData(...)我得到一个例外:

Could not establish trust relationship for the SSL/TLS secure channel with authority..."

问题:我是否还需要指定:

basicbinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;

如果是这样,我是否还需要证书?

更新:服务器无法使用客户端证书进行身份验证。所以我想我需要做的就是将basicbinding.Securtiy.Mode设置为BasicHttpSecurityMode.Transport并设置basicbinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None

0 个答案:

没有答案