Reputation: 123
I have encountered a problem with my WCF data service. One of tables contains too many data to return(about 80 fields) so that the size limit would be exceeded by only one record(above 60k by estimation, I can't tell accurately because the message can't be seen as a result of interruption of message outputting).
So far I have found that it can be worked around by two means.
For both solution are there some problems to overcome.
There are a lot of articles on web explaining how to configure WCF service to change the buffer size or reader quota. But I don't know how WCF data service works because the official documents didn't show how to configure WCF data service declaratively. Does WCF data service support the same configuration metaphors? And how to achieve it?
The WCF data service client library seems not to support json format out of box. I have to implement the same functions by myself. My question here is that is any odata json parser existing out there in C#?
Upvotes: 4
Views: 5249
Reputation: 33139
To use JSON with WCF Data Services, you need the WCF Data Services Toolkit, downloadable for free at http://wcfdstoolkit.codeplex.com.
This enables the option to tack on "$format=json" to the end of your REST queries, as in:
http://myservice/Products?$format=json
Upvotes: 1
Reputation: 91
For problem #1, check out the topic Streaming Provider (WCF Data Services), which includes this WCF configuration to enable large messages to and from an OData service using WCF Data Services:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<!-- The name of the service -->
<service name="PhotoService.PhotoData">
<!--you can leave the address blank or specify your end point URI-->
<endpoint binding="webHttpBinding"
bindingConfiguration="higherMessageSize"
contract="System.Data.Services.IRequestHandler"></endpoint>
</service>
</services>
<bindings>
<webHttpBinding>
<!-- configure the maxReceivedMessageSize value to suit the max size of
the request (in bytes) you want the service to receive-->
<binding name="higherMessageSize" transferMode="Streamed"
maxReceivedMessageSize="2147483647"/>
</webHttpBinding>
</bindings>
For problem #2, the WCF Data Services client doesn't support JSON, only Atom XML. Have you tried the post Using System.Json for non-Silverlight projects? which seems to have some helpful info on other alternatives for parsing JSON from a data service on the client.
Upvotes: 1