数据通信pression的ADO.NET数据服务数据通信、数据、ADO、pression

2023-09-04 05:14:51 作者:忘了怎么笑

我有一个.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应用程序?如果是的话,你就需要编写一些自定义的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报头,已经被写入。所以,你还需要额外的行为,在一个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.

 
精彩推荐
图片推荐