System.Security.Cryptography.Crypt ographicException: Access denied

I am trying a very simple provider hosted app. it work fine during debug but when i try to published to iis and got this error

System.Security.Cryptography.CryptographicException: Access denied. 

on TokenHeper.cs line below

private static readonly X509Certificate2 ClientCertificate = (string.IsNullOrEmpty(ClientSigningCertificatePath) || string.IsNullOrEmpty(ClientSigningCertificatePassword)) ? null : new X509Certificate2(ClientSigningCertificatePath, ClientSigningCertificatePassword);

  • Edited by VietP 9 hours 27 minutes ago
May 22nd, 2015 5:13pm

The reason is that under the credential, the app is hosted don't have access to MachineKeys folder. A good workaround with screenshot is here...

Hope this helps.

Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2015 12:53am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics