windows 服务总线禁用证书验证
windows service bus disable certificate validation
在测试期间,我尝试连接到安装在 azure VM 上的 windows 服务总线,但出现错误
System.Security.Authentication.AuthenticationException: The remote
certificate is invalid according to the validation procedure.
我试图禁用证书验证
ServicePointManager.ServerCertificateValidationCallback += CertificateValidation;
public static bool CertificateValidation(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors policyErrors)
{
return true;
}
但我仍然遇到同样的错误。
如何在连接到远程 windows 服务总线时禁用证书验证??
在客户端,我们可以使用 Net.TCP、AMQP 或 REST over HTTP 作为与服务总线通信的协议。为 ServerCertificateValidationCallback 添加事件处理仅适用于 REST over HTTP。对于其他协议,您可以在 system.serviceModel 部分添加以下配置。
<behaviors>
<endpointBehaviors>
<behavior name="DisableSSLCertificateValidation">
<clientCredentials>
<serviceCertificate>
<sslCertificateAuthentication certificateValidationMode="None" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
在测试期间,我尝试连接到安装在 azure VM 上的 windows 服务总线,但出现错误
System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
我试图禁用证书验证
ServicePointManager.ServerCertificateValidationCallback += CertificateValidation;
public static bool CertificateValidation(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors policyErrors)
{
return true;
}
但我仍然遇到同样的错误。
如何在连接到远程 windows 服务总线时禁用证书验证??
在客户端,我们可以使用 Net.TCP、AMQP 或 REST over HTTP 作为与服务总线通信的协议。为 ServerCertificateValidationCallback 添加事件处理仅适用于 REST over HTTP。对于其他协议,您可以在 system.serviceModel 部分添加以下配置。
<behaviors>
<endpointBehaviors>
<behavior name="DisableSSLCertificateValidation">
<clientCredentials>
<serviceCertificate>
<sslCertificateAuthentication certificateValidationMode="None" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>