I have a .NET web service that returns XML, and I'd like to compress this before it is sent.
There's a couple of ways that I can do this, but I'd rather not have to do it in code.
Can I set up I开发者_如何学运维IS to gzip all content returned by my WebService? It's not being called from a browser.
The other question is if this web service is being consumed by a Java client - will that affect anything?
I imagine that the client proxy will still need to decompress, but there shouldn't be any problem if I use gzip - that is a universal protocol, right?
The standard way to do this kind of thing is to use gzip compression over HTTP since it's directly supported by the protocol. As long as your client supports that then you should be good to go.
If you are writing the client from scratch with more fundamental tools you may need to add handling for this yourself: a good example of this is shown here (python).
I would expect a lot of SOAP client libraries to have built-in support for this but you'll have to try yours to be sure: if they lean on a lower level HTTP library to do their work, in all likelihood it should Just Work.
you can configure metabase.xml in iis for better control over compression. you may want redefine your web application format (.asp,.asmx,...) to metabase if it is not already included. you can see below: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/25d2170b-09c0-45fd-8da4-898cf9a7d568.mspx?mfr=true and also http://www.businessanyplace.net/?p=wscompress
精彩评论