A useful little snippet when using WCF with web services that have test SSL certificates.

When you call a service in WCF it’s still using the underlying .NET classes in System.Net so it’s actually here that you need to tell to ignore the invalid SSL certificate.

As it turns out this is very easy, all you need is the snippet below and it’s good. Obviously you shouldn’t deploy to a live environment with this code since it essentially says all certificates are valid but it’s a handy trick to get a service working with any SSL certificate for testing.

ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => { return true; };

 

Recently I wanted to send large files (several GB) from a rich desktop client to a web service. The client and service communicate using WCF and I thought that this would be quite easy. As it turns out it is but there are a few gotchas on the way.

Continue reading »

© 2012 Rob Garfoot's Blog Suffusion theme by Sayontan Sinha

Switch to our mobile site