1

I am trying to programmatically install a certificate in IIS. The solutions I have found are similar to this: Install SSL Certificate programatically using Microsoft.Web.Administration. Basically it says to do something like this:

var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
var certificate= new x509certificate2(certFilePath);
store.add(certificate); 

However, this adds the certificate to the users personal certificate store. What I am trying to do is add it to IIS Server Certificates. The user would use IIS to create a certificate request, send it to a CA to get a .cer file, then my tool would take that file and complete the certificate request, storing the certificate in IIS.

Is there a way to use Microsoft.Web.Administration to do this?

jww
  • 97,681
  • 90
  • 411
  • 885
Michael
  • 53
  • 4
  • You can find most of the features implemented in Jexus Manager already, https://github.com/jexuswebserver/JexusManager/blob/master/JexusManager.Features.Certificates/CertificatesFeature.cs – Lex Li Apr 13 '18 at 21:57
  • 1
    Here are your duplicates: [Install SSL certificate programmatically using Microsoft.Web.Administration](https://stackoverflow.com/q/5083732/608639). – jww Apr 15 '18 at 20:58
  • Possible duplicate of [Install SSL certificate programmatically using Microsoft.Web.Administration](https://stackoverflow.com/questions/5083732/install-ssl-certificate-programmatically-using-microsoft-web-administration) – NineBerry May 23 '18 at 13:32
  • Some comment on the linked question this is a duplicate of: You need to do both, first add the certificate to the Windows Certificate Store and then configure IIS to use that certificate for a certain binding. See the answer by Helephant for the second part. – NineBerry May 23 '18 at 13:34

0 Answers0