【发布时间】:2015-08-11 14:27:04
【问题描述】:
我有一个 Azure WebJob,它在本地运行时工作正常,但在 Azure 中运行时会引发异常。 WebJob 正在通过 HTTPS 进行外部调用,这在 Azure 中会产生此异常:
System.Net.WebException:请求被中止:无法创建 SSL/TLS 安全通道。在 System.Net.HttpWebRequest.GetResponse()
我还尝试使用ServicePointManager 将安全协议设置为 TLS,但这也对异常没有影响。这是我的代码的 sn-p。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
var request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
Azure 会阻止 WebJobs 访问 Internet 还是我做错了什么?
【问题讨论】:
-
还尝试伪造证书验证:ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
-
如果我也在 Azure 中从 WebApp 进行相同的调用,也会发生同样的事情。也许它在底层主机上被禁用了?
-
外部服务的证书是否有一个证书链到一个通用的 CA 证书?还是就像您在开发机器上信任的自签名证书?
-
它正在使用由证书颁发机构签署的证书。域是tls.so。我认为这与证书使用 SNI 和 Azure 的事实有关。
标签: azure azure-web-app-service azure-webjobs azure-webjobssdk