Compressing data coming out of WCF

一笑奈何 提交于 2019-12-11 17:00:11

问题


I would like to compress the data coming out of WCF on a basicHttpBinding.
I am trying to produce a new version of a system originally written as SOAP web services. In that we returned a GZipStream when we received a request.

Is there any way to do the same with WCF?

I am using VS2010, currently against .Net 3.5 but that's flexible.

Thanks


回答1:


If you plan to use IIS hosting and .NET 4.0 client you can use build in dynamic content compression in IIS. If client sends Accept-Encoding: gzip/deflate header to the service IIS will compresses the response for you. .NET 4.0 client is able to automatically decompress the response. Check Support for HTTP Decompression section.




回答2:


This page may help? It has a sample of a Compression Encoder.

http://msdn.microsoft.com/en-us/library/ms751458.aspx



来源:https://stackoverflow.com/questions/3735501/compressing-data-coming-out-of-wcf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!