Hi,
I host my service in IIS ( machine running XP ) and try it :
http://localhost/RentSoftware/Rentsoftware.svc
I receive this error :
CryptographicException: Keyset does not exist
System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer) +1460764
System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle) +55
System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair() +79
System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize) +291
System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey() +183
System.ServiceModel.Security.SecurityUtils.EnsureCertificateCanDoKeyExchange(X509Certificate2 certificate) +63
[ArgumentException: Please ensure that the certificate 'CN=Rentsoftware' has a private key that is capable of key exchange and that the process has access rights for the private key.]
System.ServiceModel.Security.SecurityUtils.EnsureCertificateCanDoKeyExchange(X509Certificate2 certificate) +2261452
To generate the certificate I did :
makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=Rentsoftware -sky exchange -pe Rentsoftware.cer
certmgr.exe -add -r LocalMachine -s My -c -n Rentsoftware -r LocalMachine -s TrustedPeople
My web.config :
<
system.serviceModel><serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="BehaviorWS" name="Rentsoftware.WCF.RentsoftwareServices">
<endpoint binding="wsHttpBinding" bindingConfiguration="TransactionalWS"
contract="Rentsoftware.WCF.Contracts.IBancoService" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="TransactionalWS" transactionFlow="true">
<reliableSession enabled="True"/>
<security mode="Message" >
<message clientCredentialType="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<!--For debugging purposes set the returnUnknownExceptionsAsFaults attribute to true-->
<behaviors>
<behavior
name="BehaviorWS"
returnUnknownExceptionsAsFaults="true" >
<serviceCredentials>
<serviceCertificate findValue="Rentsoftware" x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
</behaviors>
</system.serviceModel>
What's wrong
Thanks,
Alexnaldo Santos

Hosting WCF Service in IIS ( X509 Keyset does not exist)
Allen Clark MSFT
I think what you are asking for is a tool that will run on Windows Server that does not require any additional software to "run", am I right Probably one that supports command line, silent config as well
Perhaps you can elaborate briefly on the issues you had with running the SDK tool on your servers
Hostwap
sergey.chub
Of course, if you've changed the process identity through Application Pool configuration you'll need to make sure that identity can access the certificate.
HTH
-steve
panosRS
The account used by IIS for the anonymous case is a normal user accont like any other. Granting this account rights to access certain parts of this machine is a normal part of provisioning an IIS server in a production environment.
The WinFX SDK isn't required to grant access rights to the IIS anonymous account.
lae_1980
Nqkoi
fender46
"Also, make sure that the anonymous user account (as specified in that dialog) has access to the certificate and any other necessary resources."
How do you make sure that the user account has access to the certificate (on a production machine that does not have the WinFX SDK installed on it, only the runtime components)
Greg
coder99
I tried the example from :
..\TechnologySamples\Basic\Binding\WS\MessageSecurity\Username\CS
Run :
setup.bat
Now, I run the example and receive this error :
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM
What's wrong if I am using the MS example without any changes
I will try Infocard sample too.
Thanks,
Alexnaldo Santos
GPAustralia
cyberkid1043
xfiles
Thanks Michele,
For me it was in:
C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys
Then the other trick thing was to figure out which keyset was for the cert that NetworkService needed access to. This is a pretty cryptic activity. I think that CertKeyFileTool needs to be build in to Windows Server.
Greg
CinfulGentleman
Open up the IIS Manager MMC snap-in, navigate to the "ServiceModelSamples" virtual directory and open up its properties window. Click on the "Directory Security" and click the "Edit" button. Make sure the "enable Anonymous Access" box is checked.
Also, make sure that the anonymous user account (as specified in that dialog) has access to the certificate and any other necessary resources.