数据通信pression的ADO.NET数据服务 [英] Data compression for ADO.NET data services

查看:112
本文介绍了数据通信pression的ADO.NET数据服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.net应用程序(没有IIS),它是由一个.NET客户端应用程序消耗露出一个ADO.NET数据服务。有些调用此数据服务返回的大量数据。

I have an ADO.NET data service exposed by a .NET app (not IIS) which is consumed by a .NET client app. Some calls to this data service return large amounts of data.

我想COM preSS电线上的XML数据,以减少负载并提高性能。这可能吗?

I'd like to compress the XML data on the wire to reduce payload and improve performance. Is this possible?

推荐答案

我假设你使用托管WCF 的在你的.NET应用程序?如果是的话,你就需要编写一些自定义的<一个href="http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.messageen$c$cr.aspx"><$c$c>MessageEn$c$cr实现,因为WCF不提供这种开箱。幸运的是在SDK ,您可以使用一个样本。

I assume you're hosting using WCF in your .NET "app"? If so, you would need write some custom MessageEncoder implementation because WCF does not provide this out of the box. Luckily there is a sample in the SDK that you can use.

其实,我只是意识到,这只是一步两个取决于你的客户是否也WCF吗?虽然这将EN code的消息时,它会要求你的客户端使用一个类似配置去codeR因为实施将的没有的设置HTTP报头所必需的信号,即编码已发生一个纯的HTTP客户端。所以,如果它不是对对方WCF客户端,除了编码信息本身,你就需要使用 WebOperationContext 应用适当的内容编码:gzip 头。不幸的是,你不能因为时间 MessageEn codeR的 MessageEn codeR 的实施本身做到这一点,因为它是在这个过程为时已晚终止要求写消息内容的消息帧,在这种情况下,HTTP报头,已经被写入。所以,你还需要额外的行为,在一个<一的形式href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.ioperationbehavior.aspx"><$c$c>IOperationBehavior,适用于您的操作设置相应的头文件。

I actually just realized that this is only step one of two depending on whether or not your client is also WCF? While this will encode the message, it would require that your client be using a similarly configured decoder because that implementation will not set the HTTP headers that are necessary to signal that encoding has occurred to a "pure" HTTP client. So, if it's not a WCF client on the other side, in addition to encoding the message itself, you would need to use the WebOperationContext to apply the appropriate Content-Encoding: gzip header. Unfortunately you cannot do this within the MessageEncoder implementation itself because it's too late in the process because by the time the MessageEncoder is asked to write the message contents the message frame, in this case the HTTP headers, has already been written. So, you would also need additional behavior, in the form of an IOperationBehavior, applied to your operations that sets the headers accordingly.

这篇关于数据通信pression的ADO.NET数据服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆