0

Related To:

WCF GZip Compression Request/Response Processing

Web​Client.​Get​Web​Request(Uri) Method


I want to do that has been said in the first article. I don't know what does Proxy Class means?

I add a WCF web service with name: MyServiceClient.

I wrote this code in a class in APP_Code:

public partial class MyServiceClient : WebClient 
{
    protected override System.Net.WebRequest GetWebRequest(Uri uri)
    {
        System.Net.HttpWebRequest rq = (System.Net.HttpWebRequest)base.GetWebRequest(uri);
        rq.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
        return rq;
    }
}

and calling service code:

using (ServiceReference1.MyServiceClient client = new ServiceReference1.MyServiceClient())
{
    //Call
    client.MyMethod();
}

but when I run this code and call my web service, above code didn't execute.

the second problem is MyServiceClient generated automatically by VS and it's not partial

Where is my mistake?

Thanks

svick
  • 236,525
  • 50
  • 385
  • 514
Arian
  • 12,793
  • 66
  • 176
  • 300

0 Answers0