【问题标题】:windows service bus disable certificate validationWindows 服务总线禁用证书验证
【发布时间】:2017-09-22 11:48:12
【问题描述】:

在测试期间,我尝试连接到安装在 azure VM 上的 Windows 服务总线,但出现错误

System.Security.Authentication.AuthenticationException:远程 根据验证程序,证书无效。

我尝试禁用证书验证

   ServicePointManager.ServerCertificateValidationCallback += CertificateValidation;

    public static bool CertificateValidation(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors policyErrors)
    {
        return true;
    }

但我仍然遇到同样的错误。

如何在连接到远程 Windows 服务总线时禁用证书验证?

【问题讨论】:

    标签: c# windows azure azureservicebus servicebus


    【解决方案1】:

    在客户端,我们可以使用 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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多