WCF error: “The X.509 certificate CN=localhost chain building failed …”

后端 未结 8 1853
挽巷
挽巷 2020-12-14 05:52

I\'m getting this error while attempting to make my WCF client and server talk to each other.

The X.509 certificate CN=localhost chain building faile

相关标签:
8条回答
  • 2020-12-14 06:33

    I fixed the problem by turning off validation in my code like this:

    client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = 
    System.ServiceModel.Security.X509CertificateValidationMode.None;
    

    Where client is an instance of my service reference.

    0 讨论(0)
  • 2020-12-14 06:38

    The correct thing to do is to setup your own Dev/Test Trusted Root Certificate and sign your client and service certificates with this.

    Bypassing chain trust in your Dev/Test environment may "work" but your Dev/Test environment is now configured differently to Production, which is not a great idea as you may find some tests produce false positives or false negatives.

    0 讨论(0)
提交回复
热议问题