This is a mirror of official site: http://jasper-net.blogspot.com/

How to test SSL based WCF services

| Monday, December 19, 2011
I usually work with WCF service that needs to be secured with Certificates or simply using HTTPS. The usual question from other dev in the team is “how can I simulate HTTPS to work with WCF?”

The problem arise that to test https sites, people usually work with IIS self issued certificates.

SNAGHTMLa82f3d_thumb.png

This works great for sites, you can use the auto signed certificate in your sites in https binding, then when you navigate to the site you usually got an error because the certificate is not issued for the right site. What I need is usually to modifiy the hosts file in windows, creating an alias of www.mydomain.com to 127.0.0.1, so I can directly point to the right address with WCF client application and can simply manage to use the local or remote service simply modifying the hosts file.

Sadly enough, WCF does not tolerate problem in certificates and this makes useless working with Self-Signed Certificate. To be able to use a WCF Service secured with SSL in your dev machine you should issue yourself a valid certificate. The solution is using the SelfSSL.exe tool that comes with the IIS6 Resource Kit Tools.

Once installed you can simply go to installation folder with Administrator Command Prompt (you need to launch the command prompt as administrator or it wont work) and simply create a valid certificate with this command line

Selfssl /N:CN=www.codewrecks.com /V :2000 /S:3

as you can see with the option /N:CN you are able to specify the Common Name you want to use, the /V option is used to specify the duraction in years of the certificate, and the /S: is used to specify the Id of the site you want to change, just select the “site” node on IIS7 administration console to see the ID assigned to each site.

image_thumb4.png

Read more: Alkampfer's Place
QR: http://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://www.codewrecks.com/blog/index.php/2011/11/21/how-to-test-ssl-based-wcf-services/

Posted via email from Jasper-net

0 comments: