WCF client security negotiation failing after logging off
Let me first acknowledge that this issue is almost exactly the same as this one: wcf certificate Keyset does not exist problem after reboot
But I've read through that and it's not applicable.I have a WCF client and service using wsHttpBinding, using certificates and PeerTrust for authentication. The service is hosted on a separate IIS server. The client is on my machine. I have the correct certificates installed. I install and run everything under my user account (I'm in the Administrator group). Everything works.
However, when I log off my machine for the night, and log back in in the morning and try to run my client application as myself, I get this error: {"It is likely that certificate '[client certificate]' may not have a private key that is capable of key exchange or the process may not have access rights for the private key. Please see inner exception for detail."}
Inner exception says: {"Keyset does not exist"}I can run the application as Administrator and it works.
If, however, I use the MMC snap-in to delete, then Import the certificates again, I can run the client as myself fine with no errors. I can log off and on and the same thing keeps happening. It doesn't work until I remove, then Import the certificates again.The only thing I'm doing in my client application that isn't "standard" is that I'm not using the config file for WCF. I'm setting up everything in code. But that rea开发者_高级运维lly only involves "reading" the certificates, so it shouldn't make a difference.
So my question is, why does logging off seem to invalidate myself as a user of the certificates? This will obviously create a problem when I distribute the client and nobody can use the application after logging off once.
You can install certificate for Local Computer? That will prevent this behavior.
精彩评论