Can you use WCF Data Services (ne OData, ne Astoria, ne ADO.NET Data Service) with NetTcpBinding?
Asked Answered
R

2

5

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?

Rauwolfia answered 3/9, 2010 at 19:43 Comment(0)
G
3

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.

Goad answered 3/9, 2010 at 20:50 Comment(1)
While it is technically possible to create a custom host, OData is way too tightly bound to HTTP to make this feasible. Too bad... having a OData service with persistent connections would be nice.Rauwolfia
R
4

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?

Rauwolfia answered 3/9, 2010 at 21:3 Comment(3)
IDataServiceHost still requires HTTP though, doesn't it?Indelicate
I'm curious Simon - did you come up with a good solution for providing the customisable querying features of WCF Data Services in a WCF/TCP setup?Indelicate
Not in a good way. I implemented a subset of the OData URI schema that I needed for my service and did it over net.tcp, but it's not truly an OData service. You might try looking at ODataLib on CodePlex... this is Microsoft's open-source implementation of the OData service core. At some point I hope to look at this and see what can be gleaned, but project schedules march apace. You know how it is.Rauwolfia
G
3

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.

Goad answered 3/9, 2010 at 20:50 Comment(1)
While it is technically possible to create a custom host, OData is way too tightly bound to HTTP to make this feasible. Too bad... having a OData service with persistent connections would be nice.Rauwolfia

© 2022 - 2024 — McMap. All rights reserved.