WCF newbie - how to install and use a SSL certificate?

前端 未结 4 1799
说谎
说谎 2021-01-07 12:46

This should be a snap for anyone who\'s done it before...

I\'m trying to set up a self-hosted WCF service using NetTcpBinding. I got a trial SSL certificate from Th

相关标签:
4条回答
  • 2021-01-07 13:22

    If the certificate is for ssl.mydomain.com you need to acces the server at that adress. It seems like you are trying to acces it through localhost, which obvisouly is not the same.

    0 讨论(0)
  • 2021-01-07 13:25

    The problem seems to be that the server certificate you have installed on your server is not trusted by the client.

    For it to be trusted the root CA certificate of the server certificate needs to be in the "Trusted Root Certification Authorities" store of the user running the client. If you get a "production" level server certificate from Thawte or some other similar CA it will already be trusted by most machines in the world.

    However, judging by the error message (where the subject distinguished name of the certificate contains "OU=For Test Purposes Only. No assurances.") your certificate is a test certificate and you therefore need to add the CA certificate to your "Trusted Root Certification Authorities" store manually. The root certificate can usually be downloaded from the CA's (Thawte in your case) website.

    0 讨论(0)
  • 2021-01-07 13:26

    The problem is the issuer of your certificate is not trusted.

    WCF will try to verify the chain of certificates. One solution is to make sure the certificate used to issue the one you have is stored in the trusted issuers store of the server.

    You could also add a custom certificate policy to bypass validation on your development env (as explained here)

    You could also put your certificate in the 'Trusted People' stored and set the certificateValidationMode to ChainOrPeerTrust. This will try to validate the complete chain unless you put the certificate into the 'Trusted People' store. This would allow you to leave the configuration and code untouched for the deployment to production env. You will simply put your certificate in the 'Trusted People' store in your development env.

    0 讨论(0)
  • 2021-01-07 13:27

    in .net core 2.0 we have to do this from nuget package manager search for System.ServiceMode you can use System.ServiceModel.primitives.

    updated as of april 2018

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