How do I get a reference to a certificate in Appharbor from our .NET application

Rupert Jenner's Avatar

Rupert Jenner

02 Jul, 2019 12:33 PM

We are hosting our db on RavenHQ and website on Appharbor. We successfully installed the Raven certificate on appharbor but our url returns the error: "Forbidden access to Raven4Test@, a certificate is required".

When running locally we can connect, but not through appharbor. Our local connection code looks like this:

X509Store x509Store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
   x509Store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
   X509Certificate2Collection collection = x509Store.Certificates;

  else if (connectionName == "raven4")
                DatabaseName = "Raven4Test";
                Urls = new string[] { "" };
                Certificate = null;
                foreach (var cert in collection)
                    if (cert.Subject =="CN=Raven4Test cert")
                        Certificate = new X509Certificate2(cert);
But we don't know how to fetch this certificate when working with the certificate in Appharbor. There doesn't seem to be an API to get it. Please help.

  1. Support Staff 1 Posted by rune on 05 Jul, 2019 08:45 AM

    rune's Avatar

    Hi Rupert,

    Sorry about the delay here -- it sounds like you might have to install the certificate under your user profile first? You can install certificates under your user profiles certificate store, but you'll need to install the certificate when you app is deployed as the user profile changes on every deployment.

    Could you perhaps try and install the certificate during application startup? You might be able to use this approach to install it under the current user profile.

    It might also be worth looking into whether the RavenDB client will accept a certificate/keypair that's initialized by your application without being installed on the server. In that case you might want to just include the pfx file in your repository and load it when initializing a connection to the RavenDB server, but otherwise it should be possible to make this work by installing it prior to establishing a connection to the server.


  2. 2 Posted by rupertjenner on 05 Jul, 2019 08:48 AM

    rupertjenner's Avatar

    Thanks Rune,


    We just got this sorted yesterday. It was the code snippet you reference here that we needed. We found it in one of your other support cases.





    Rupert Jenner

    Chief Executive Officer


    Steward House, 14 Commercial Way

    Woking, GU21 6ET


    Tel: +44 (0) 7879 883272

    Email: <mailto:[email blocked]> [email blocked]

    Web: <>

  3. Support Staff 3 Posted by rune on 05 Jul, 2019 09:02 AM

    rune's Avatar

    Hi Rupert,

    Ok great, I'm glad you were able to find and resolve this on your own. Please don't hesitate to reach out if there's anything else I can help with!


  4. rune closed this discussion on 05 Jul, 2019 09:02 AM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac