ShdowRunner
ShdowRunner

Reputation: 53

RavenDb - CertificateNameMismatchException in secured mode

I have a RavenDB server set up and running in a secured mode. The Server certificate is self-signed and was added after the initial installation was completed. settings.json file looks like this.

I can access server management studio in the browser (Chrome) on 127.0.0.1:8080. After that, I have issued a client certificate and registered it in Windows. Then in a simple .NET Framework Console application, I'm trying to store some data into the database.

I use this sample code to create DocumentStorage object. Storage is initializing without any exception, but when I call the session's SaveChanges method, I'm getting CertificateNameMismatchException:

The hostname of the server URL must match one of the CN or SAN properties of the server certificate: CN=ravenDb.test.com, DNS Name=ravenDb.test.com

What am I doing wrong?
Is it a server and/or client certificate issue ? or the server itself is incorrectly configured?

Upvotes: 3

Views: 226

Answers (1)

Iftah
Iftah

Reputation: 356

When working with certificates, you must use your domain name to access the server and not the IP address directly.

Set the configuration property 'PublicServerUrl' to https://ravenDb.test.com:8080 and 'PublicServerUrl.Tcp' to tcp://ravenDb.test.com:38888 and don't forget to set DNS records (or edit the local hosts file) for ravenDb.test.com to point to 127.0.0.1.

Upvotes: 4

Related Questions