Search code examples
c#soapfiddler

Unable to use webservice without fiddler


When I try to use a webservice i got an error which says "Request was cancelled". When I open fiddler and give corresponding settings (defaultProxy, etc.) I can use the webservice successfully. Does anybody experienced something like that? How did you tackle the issue?


Solution

  • Well I find a way to get over the problem by writing an override for GetWebRequest method of related SoapHttpClientProtocol to turn keep-alive false by default. Roughly adding these lines

    protected override System.Net.WebRequest GetWebRequest(Uri uri)
        {
            System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)base.GetWebRequest(uri);
            webRequest.KeepAlive = false;
            return webRequest;
        }
    

    on top of reference file (Reference.cs) of related web service solves the issue.