您可以将 WCF 数据服务(例如 OData、Astoria、ADO.NET 数据服务)与 NetTcpBinding 一起使用吗?

发布于 2024-09-16 22:38:50 字数 143 浏览 7 评论 0原文

我正在考虑通过慢速卫星连接创建数据查询 WCF 服务,我真的很喜欢 WCF 数据服务。我看到的问题是 HTTP 是一种非常详细的格式,并且由于我所做的一切都是内部的和 .NET,是否可以使用 NetTcpBinding 来减少一些开销?

这可能吗?可取吗?

I'm looking at creating a data query WCF service over a slow satellite connection and I really like WCF Data Services. The problem I see is that HTTP is a very verbose format and since everything I'm doing is internal and .NET, is it possible to use NetTcpBinding instead to reduce some of the overhead?

Is this even possible? Advisable?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁吢 2024-09-23 22:38:50

在我自己研究这个问题时,我遇到了关于自托管 WCF 的 MSDN 文章数据服务。本文指出,您可以使用 DataServiceHost< 托管该服务/a> 仍然需要 HTTP(它派生自 WebServiceHost)。

但您也可以使用 IDataServiceHost。以下是 MSDN 文章的摘录:

对于 WCF 主机的情况
实施限制太多,你
还可以为
数据服务。任何班级
实现 IDataServiceHost 接口
可以用作网络主机
数据服务。自定义主机必须
实现 IDataServiceHost
接口并能够处理
遵循以下基本职责
数据服务主机:

  • 为数据服务提供服务根路径。
  • 将请求和响应标头信息处理到适当的位置
    IDataServiceHost 成员实现。
  • 处理数据服务引发的异常。
  • 验证查询字符串中的参数。

这篇文章似乎表明 MS 已将数据服务职责与网络接口职责正确分离。如果是这样,那么我应该能够编写一个 NetTcpDataServiceHost。有人写过 IDataServerHost 吗?有什么建议吗?

While researching this on my own, i ran across the MSDN article on Self-Hosted WCF Data Services. This article notes that you can host the service with DataServiceHost which still requires HTTP (it's derived from WebServiceHost).

But you can also roll your own host using IDataServiceHost. Here's an excerpt from the MSDN article:

For cases where the WCF host
implementation is too restrictive, you
can also define a custom host for a
data service. Any class that
implements IDataServiceHost interface
can be used as the network host for a
data service. A custom host must
implement the IDataServiceHost
interface and be able to handle the
following basic responsibilities of
the data service host:

  • Provide the data service with the service root path.
  • Process request and response headers information to the appropriate
    IDataServiceHost member implementation.
  • Handle exceptions raised by the data service.
  • Validate parameters in the query string.

The article seems to suggest that MS has properly segrated data-service responsibilities from network interface responsibilities. If that's so, then I should be able to write a NetTcpDataServiceHost. Has anyone ever written a IDataServerHost? Any suggestions?

滥情哥ㄟ 2024-09-23 22:38:50

不,WCF 数据服务构建在 REST 之上,而 REST 本身非常密切且完全基于 HTTP 动词,例如 GET、PUT、POST 等 - 您不能通过 NetTcp 运行这些动词,因为它们本质上与 HTTP 协议相关联堆。

也许您还有其他选择来减少传输的数据?调整您的对象 - 如果可以的话,修剪脂肪 - 一次检索的行数以及传输的属性/数据字段的数量。这可能是你最有希望的方法。

No, WCF Data Services are built on top of REST, and REST itself is very intimately and completely based on the HTTP verbs like GET, PUT, POST etc. - you cannot run those over NetTcp, since those are intrinsically tied to the HTTP protocol stack.

Maybe there are other options for you to reduce the data being transmitted? Tweak your objects - trim the fat, if you can - both on the number of rows retrieved at once, and the number of attributes/data fields transmitted. That's probably you're most promising approach.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文