© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
3 replies
Velcer

❔ Trouble with C# certificates

Greetings,

In a local environment I have no issues at all.
When I push my Game Server (the client) to a hosted environment, I get an error saying the following:
{"Type":"InvalidAuth","Message":"This server requires client certificate for authentication, but none was provided by the client. Did you forget to install the certificate?"}
{"Type":"InvalidAuth","Message":"This server requires client certificate for authentication, but none was provided by the client. Did you forget to install the certificate?"}


I contacted Ravendb support and they said the following:
Basically it's about the X509 certificate's private key. In a lot of platform you need to allow the app to load that certificate explicitly e.g. by providing its thumbprint.
Basically it's about the X509 certificate's private key. In a lot of platform you need to allow the app to load that certificate explicitly e.g. by providing its thumbprint.

My assumption of this response is that I need to first install the certificate on said machine before I can use it.
The problem is that I don't have permissions to install a certificate on that machine.

I am wondering what can be done.

The following code is what I am using:
using Raven.Client.Documents;
using Raven.Client.Documents.Conventions;
using System;
using System.IO;
using System.Security.Cryptography.X509Certificates;

public static class DocumentStoreHolder
{
    private const string CERTIFICATE_PASSWORD = "B8ABC07EA75BC5B18DB92386A726F93A";
    private static string CERTIFICATE_PATH = Path.GetFullPath("certificate.pfx");

    public static X509Certificate2 GetCertificate() 
    {
        return new X509Certificate2(CERTIFICATE_PATH, CERTIFICATE_PASSWORD);
    }
    public static void Initialize() 
    {
        var certificate = GetCertificate();

        LazyStore = new Lazy<IDocumentStore>(() =>
        {
            var store = new DocumentStore
            {
                Urls = new[] { "https://a.free.starmmo.ravendb.cloud" },
                Database = "StarMMO",
                Certificate = certificate,
                

            };
            return store.Initialize();
        });

    }

    private static Lazy<IDocumentStore> LazyStore;

    public static IDocumentStore Store => LazyStore.Value;
}
using Raven.Client.Documents;
using Raven.Client.Documents.Conventions;
using System;
using System.IO;
using System.Security.Cryptography.X509Certificates;

public static class DocumentStoreHolder
{
    private const string CERTIFICATE_PASSWORD = "B8ABC07EA75BC5B18DB92386A726F93A";
    private static string CERTIFICATE_PATH = Path.GetFullPath("certificate.pfx");

    public static X509Certificate2 GetCertificate() 
    {
        return new X509Certificate2(CERTIFICATE_PATH, CERTIFICATE_PASSWORD);
    }
    public static void Initialize() 
    {
        var certificate = GetCertificate();

        LazyStore = new Lazy<IDocumentStore>(() =>
        {
            var store = new DocumentStore
            {
                Urls = new[] { "https://a.free.starmmo.ravendb.cloud" },
                Database = "StarMMO",
                Certificate = certificate,
                

            };
            return store.Initialize();
        });

    }

    private static Lazy<IDocumentStore> LazyStore;

    public static IDocumentStore Store => LazyStore.Value;
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

❔ Trouble practicing C#
C#CC# / help
3y ago
✅ Certificates recommendation
C#CC# / help
4y ago
❔ Trouble with modifiers
C#CC# / help
3y ago