I have given the DefaultAppPool user, the IIS_IUSRS user, and the Everyone group Read access to the PFX file. I have given the DefaultAppPool user, the IIS_IUSRS user, and the Everyone group Modify access to the MachineKeys folder. I am receiving the CryptographicException: Access denied when running this code: X509Certificate2 x509Certificate = new X509Certificate2(rawData, password, X509KeyStorageFlags.MachineKeySet); Where rawData is a byte array of the contents of the PFX file read by using File.ReadAllBytes.
I had to take ownership of the MachineKeys folder using an Administrative command line before I could set permissions on it without getting errors, but that has been done now.
I think I've followed the instructions in the article that you linked to, but it still isn't working. I also don't understand how, if it is related to permissions, why the sp.pfx file included with the examples works fine when located in the same folder and with the same permissions.
Any help would be appreciated.
|