Debug SOAP and REST in IIS Express using Fiddler

I’ve been using Visual Studio 2013 Express to make a C# website that uses SOAP to request services from another company.  Everything was working fine, until one day I suddenly started getting HTTP 500 errors.  Naturally the service provider said it wasn’t them, so out came Fiddler.  Funnily enough the request worked straight away in Fiddler, so I needed to find out what the difference was between a Fiddler request and a request from my localhost.

I followed this guide here:


GlobalProxySelection.Select = new WebProxy(“”, 8888);

should now be:

WebRequest.DefaultWebProxy = new WebProxy(“”, 8888);

Because of this issue, we can’t debug simply using ‘localhost’.  So I used this guide to use a custom host name as opposed to ‘localhost’ – using the following locations as reference for the applicationhost.config file:

Pre-Visual Studio 2015

Visual Studio 2015+

In Fiddler, because I’m using HTTPS, I had to go to Tools > Fiddler Options > HTTPS tab and check ‘Decrypt HTTPS traffic’

And finally I needed to add this line BEFORE my C# HttpWebRequest code for the request to work properly when Fiddler was running:

ServicePointManager.ServerCertificateValidationCallback +=(sender, cert, chain, sslPolicyErrors) => true;

I think that’s it…..

Leave a Reply

Your email address will not be published. Required fields are marked *