Expand the tree on the left side ( Certificates (Local Computer) / Personal / Certificates ), select the Certificates node and locate your certificate. Right-click on your certificate, select All Tasks / Manage Private Keys: You now will see all accounts that can access the private key of your certificate.
Assign the existing private key to a new certificateSign in to the computer that issued the certificate request by using an account that has administrative permissions. Select Start, select Run, type mmc, and then select OK. On the File menu, select Add/Remove Snap-in. In the Add/Remove Snap-in dialog box, select Add.
The exception that is thrown when an error occurs during a cryptographic operation.
This is most likely because the IIS user doesn't have access to the private key for your certificate. You can set this by following these steps...
It will probably be a permissions problem on the certificate.
When running a unit test you are going to be executing those under your own user context, which (depending on what store the client certificate is in) will have access to that certificate's private key.
However if your WCF service is hosted under IIS, or as a Windows Service it's likely it will be running under a service account (Network Service, Local Service or some other restricted account).
You will need to set the appropriate permissions on the private key to allow that service account access to it. MSDN has the details
I've had identical issue last night. Permissions on private key were set correctly, everything was apparently fine except the Keyset doesn't exist error. In the end it turned out that certificate was imported to the current user store first and then moved to local machine store. However - that didn't move the private key, which was still in the
C:\Documents and settngs\Administrator...
instead of
C:\Documents and settngs\All users...
Altough permissions on the key were set correctly, ASPNET couldn't access it. When we re-imported certificate so that private key is placed in the All users branch, the problem disappeared.
To solve the “Keyset does not exist” when browsing from IIS: It may be for the private permission
To view and give the permission:
To give the permission:
Had the same problem while trying to run WCF app from Visual Studio. Solved it by running Visual Studio as administrator.
I have faced this issue, my certificates where having private key but i was getting this error("Keyset does not exist")
Cause: Your web site is running under "Network services" account or having less privileges.
Solution: Change Application pool identity to "Local System", reset IIS and check again. If it starts working it is permission/Less privilege issue, you can impersonate then using other accounts too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With