Search code examples
c#wcfentity-frameworkwcf-data-services

Change max message size in DataServiceContext


I am using DataServiceContext to get data from a wcf service which is hosting a dbml. It works fine in general but queries that return large amounts of data (e.g. binary files) create the usual WCF error:

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding 

The problem is I cannot find how to change the message size of the channel.

Here's the code I use to initialise the class:

var channel = new RPDataModelDataContext(DataServiceBaseAddress);
channel.Credentials = CredentialCache.DefaultCredentials;

where RPDataModelDataContext is a client proxy class generated with the entityframework

public partial class RPDataModelDataContext : 
    global::System.Data.Services.Client.DataServiceContext
{
    // ...

Can anyone point me to the right direction?


Solution

  • After some research I found no way to customise the Data channel service client. So I guess that its not possible to.

    One has to create a normal wcf client to interact with it.