Search code examples
c#certificatex509certificatecacertificate-authority

How to check connectivity to ADCS Certificate Authority Server from a C# Application?


I have CA server set up in windows server. I have a client code in C# for ADCS certificate management, I am able to retrieve signed certificates from an ADCS certificate authority by sending CSR using DCOM interface. Before submitting CSR to CA, I need to check whether the CA feature is running or not in CA the server. How can I implement this connectivity check in my application?


Solution

  • You can use CertSrvIsServerOnline function to check if server is online or not. If server is offline, the function will hang for about 20 seconds or so.

    You can also try to call ICertRequest::GetCAProroperty against whatever property. Wrap this method in try/catch blocks. If server is down, an exception will be thrown.