I am trying to deploy a high trust app and my app is failing consistently in TokenHelper class with below error:

Inner Exception Type : System.Security.Cryptography.CryptographicException, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Access denied.

Stack Trace :    at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
                                                   at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx)
                                                   at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags)
                                                   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password)
                                                   at Iaea.SharePoint.Esp.Core.TokenHelper..cctor()

Somehow it is not able to read the certificate. I have double checked that the app pool account under which the app runs in IIS have rights in the folder where the certificate is present. Any help would be highly appreciated.

1 Answer 1


Make sure the certificate path provided in the web config is correct and the certificate is .pfx extension.

Also, make sure you are using the same self signed certificate that you used for setting up the SP Trusted Root Authority.

Note: its never too late to revisit the entire S2S High Trust App Set-up from msdn.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.