Skip to content
Discussion options

You must be logged in to vote

You usually don't need to elevate the running service. Install/trust the root once (as admin), then the service can just load that same cert.

For a Windows service:

// one-time setup (run elevated / installer), then persist the pfx
proxyServer.CertificateManager.CertificateEngine = CertificateEngine.BouncyCastle;
proxyServer.CertificateManager.CreateRootCertificate(true);
proxyServer.CertificateManager.TrustRootCertificateAsAdmin(); // Local Machine store

Then on service start, just load it (don't recreate every time):

proxyServer.CertificateManager.RootCertificate =
    proxyServer.CertificateManager.LoadRootCertificate();

Notes that match your symptoms:

  • LocalSystem is fine; the importa…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by justcoding121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants