WCF Server "Key set not found" exception

WCF
If you get this message, it means there was either an access denial to the server certificate private key or the certificate is not associated with any keyset at all.

To grant the required permissions you have to do two things:
  1. Find the private key  (If it is a software key).
  2. Change the permission with cacls.
In windows SDK there is a sample which shows how to find the file associated with the private key.
"FindPrivateKey.exe"

FindPrivateKey helps user to find the location of the Private Key file of a X.50
9 Certificate.
Usage: FindPrivateKey [{ {-n } | {-t
humbprint>} } [-f | -d | -a]]
        subject name of the certificate
         thumbprint of the certificate (use certmgr.exe to get it)
       -f            output file name only
       -d            output directory only
       -a            output absolute file name
e.g. FindPrivateKey My CurrentUser -n "CN=John Doe"
e.g. FindPrivateKey My LocalMachine -t "03 33 98 63 d0 47 e7 48 71 33 62 64 76 5
c 4c 9d 42 1d 6b 52" -c

Then run cacls to change the permissions:

cacls "c:\Documents and Settings\All Users\Application Data\M
icrosoft\Crypto\RSA\MachineKeys\ffdf2163fc94489b91c479a9d791798b_4394aa3e-f640-4
815-b9d2-513f3d541fd5" /E /G "ASPNET":R


Post a Comment

Previous Post Next Post