X509Certificate Constructor Exception

后端 未结 9 1848
梦如初夏
梦如初夏 2020-11-27 15:38
//cert is an EF Entity and 
//    cert.CertificatePKCS12 is a byte[] with the certificate.

var certificate = new X509Certificate(cert.CertificatePKCS12, \"SomePassw         


        
9条回答
  •  执笔经年
    2020-11-27 16:05

    On an application running IIS 10, I managed to fix the access denied error by using LocalSystem identity for the app pool with the following code:

    new X509Certificate2(certificateBinaryData, "password"
                                   , X509KeyStorageFlags.MachineKeySet |
                                     X509KeyStorageFlags.PersistKeySet);
    

    Enabling Load User Profile didn't work for me and while there where many suggestions to do this, they did not indicate that setting for 'Load User Profile' to True only works on user accounts and not:

    1. ApplicationPoolIdentity
    2. NetworkService

提交回复
热议问题