Reputation: 62031
We're running an HTTPS WebRole in Windows Azure DevFabric. DevFabric comes with its own SSL certificate, issued to 127.0.0.1. Is there any way to make it use a different certificate?
Background: we actually want to access the web services from another machine. I know, I know, it wasn't designed for that, but that's what we'd like to do if at all possible. For HTTP this works fine - we have a port redirector running that redirects ports on the machine's external IP to the same ports on 127.0.0.1. However, for SSL, the connection fails, because the hostname in the URL doesn't match the hostname in the certificate (which is "127.0.0.1").
Upvotes: 1
Views: 428
Reputation: 15860
In this scenario, what you want to do, is ignore the certificate errors if you're running in Dev:
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateCertificate);
private static bool ValidateCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
#if DEBUG
return true;
#endif
return (sslPolicyErrors == SslPolicyErrors.None);
}
Upvotes: 1