Chris Cooper
Chris Cooper

Reputation: 899

.NET doesn't trust my self-signed certificate, but IE does?

I've got a self-signed certificate for testing in development. I've added it under the "Trusted Root Certification Authorities" folder in certificate manager, and when visiting the site under IE or Chrome it's accepted as valid (under Firefox it doesn't like the fact it is self-signed).

However, when my C# client tries to connect to call a webservice or to open an SSL socket, it get an exception saying "Could not establish trust relationship for the SSL/TLS secure channel with authority '[server address]'.". And even more annoyingly this doesn't happen when I debug via Visual Studio, it only happens when I try and run it from a test machine which has also had the certificate added to the trusted group.

What criteria is .NET using to validate my certificate?

Upvotes: 15

Views: 3499

Answers (1)

Remus Rusanu
Remus Rusanu

Reputation: 294267

Did you add the certificate as a trusted root authority under the Current User, a specific Service Account or under Local Machine? Most likely you only added the new root authority for the current user only, so any service that runs under a different account will not trust the certificate.

Upvotes: 16

Related Questions