I am creating a self-signed certificate for converting IIS web-ste from http to https. Essentially, I am using the code suggested here. It works perfectly fine with Windows server 2019. However, when the same code is deployed in Windows Server 2012 R2, i am getting the error around the code -
CX509PrivateKey privateKey = new CX509PrivateKey();
I am getting the exception, which is like this - *"While performing the operation create encountered an Exception:
Unable to cast COM object of type 'CERTENROLLLib.CX509PrivateKeyClass' to interface type 'CERTENROLLLib.IX509PrivateKey2'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{728AB362-217D-11DA-B2A4-000E7BBB2B09}' failed due to the following error: No such interface supported (0x80004002 (E_NOINTERFACE)).
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at CERTENROLLLib.CX509PrivateKeyClass.set_ProviderName(String pValue)"*
I tried the solutions suggested here, but nothing works for me.
I am using .Net Core 5.0
for creating the web site. In fact, using "CERTENROLLLib"
from creating the self signed certificate and deploying it to IIS
web site was the only solution which worked for me. However, when the website is created in Windows Server 2012 R2
, I got this error.
User contributions licensed under CC BY-SA 3.0