I have a service hosted over http/https on my local machine. When I consume the service over http it works perfectly. It also works when I make https request on ajax. But it's not work, when I try to consume it from code behind of client app. It shows the an error message as follows:
"The remote certificate is invalid according to the validation procedure"
Can somebody help me out?
This is because, the certificate you use on your local IIS, is a virtual one. Probably, you will not get it in real time. There are several hacks available to make it work locally.
NOTE: Never ever do this on production...
Add following code segment(an event handler), before calling any method of service.
ServicePointManager.ServerCertificateValidationCallback +=
EasyCertCheck;
bool EasyCertCheck(object sender, X509Certificate cert,
X509Chain chain, System.Net.Security.SslPolicyErrors error)
{
return true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With