Chhatrapati Sharma
Chhatrapati Sharma

Reputation: 623

WCF service certificate giving error on IIS, running fine on local port

i have added wcf service reference in project and i have installed certificate also on my pc.

when i am using wcf method throug port like (localhost:3353/wcfproj/add.aspx) it's running fine but when host it on my iis and use method that time it's giving below error

"The request was aborted: Could not create SSL/TLS secure channel."

s.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByThumbprint, "1e fb 2c a7 75 be b7 18 e5 c5 1d 14 4f 87 2c 77 15 70 cf 57");

Thanks in advance

Upvotes: 1

Views: 261

Answers (2)

Dotnet Developer
Dotnet Developer

Reputation: 170

i also got this type of prob so please try this. it may help you

Issue: Install client certificate in IIS

download WinHttpCertCfg. and install it

SOLVED using command

Cd C:\Program Files\Windows Resource Kits\Tools

WinHttpCertCfg.exe -g -c LOCAL_MACHINE\MY -s “SSLCertName” -a ASPNET

Perhaps for webserver it need network servcie

WinHttpCertCfg.exe -g -c LOCAL_MACHINE\MY -s " IssuedToName " -a "Network Service"

Upvotes: 1

Brad
Brad

Reputation: 84

Remove the spaces from the thumbprint.

s.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByThumbprint, "1efb2ca775beb718e5c51d144f872c771570cf57");

Also make sure the account running this code has access to the cert's private key.

Edit: I just re-read your question... It looks like a private key issue. Make sure the account running the app pool for the code has access to the private key for the client certificate.

Upvotes: 0

Related Questions