开发者

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

开发者 https://www.devze.com 2022-12-12 22:46 出处:网络
I am trying to consume a webservice and it is givi开发者_如何学Gong throwing this error.When I\'ve had errors like that they were due to either not having the service host name matching the one in the

I am trying to consume a webservice and it is givi开发者_如何学Gong throwing this error.


When I've had errors like that they were due to either not having the service host name matching the one in the certificate it presents, or, less often, not having the appropriate certificate chain on the client to verify the server's certificate.

I would check the name you are contacting the service by and what the certificate it sends say -- you can watch the SSL negotiation with WireShark or similar, and see the strings in the second server packet.


This is a certificate related error. Whenener we hit a secure URL in web browser, the browser will ask for permission with some warnings like "the certificates are not trusted, click to continue etc"

But when we consume the a secure webservice URL in code nothing like that happens.

But we have a solution to this problem.For this we need to create a class inheriting ICertificatePolicy interface.

This thing is properly explained and solution code available on this link Click to See

0

精彩评论

暂无评论...
验证码 换一张
取 消