问题
I'm invoking a webservice using C# and Visual Studio 2010. VS2010 takes care of generating the client proxy code when I provide the link to the WSDL. Is there a way to configure the client code to set the 'Accept-Encoding' header to (gzip, deflate) and handle compressed responses from the server? If not, how do I write custom code to handle this?
回答1:
Try this. It is an article on using compression with a WCF service. I am making the assumption (possibly incorrect) that you have control of both the service and the client. If this is somebody else's service, you can't perform a Harry Potter and make it magically compress, unless they have coded that possibility. If you are in complete control of both ends, you can make the magic happen. ;-)
来源:https://stackoverflow.com/questions/9787923/using-compression-with-c-sharp-webservice-client-in-visual-studio-2010