WCF maxReceivedMessageSize

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
hamej
Posts: 37
Joined: Thu Oct 01, 2015 8:41 am

WCF maxReceivedMessageSize

Postby hamej » Thu Feb 25, 2016 4:34 am

I have created a WCF project for my C#/XAML project. Works fine, but when running requests with large amount of data, it fails with "The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element."

Where do I put the MaxReceivedMessageSize property? I have tried to do the same as in the WCF service for my Silverlight app, but that doesn't help.

hamej
Posts: 37
Joined: Thu Oct 01, 2015 8:41 am

Re: WCF maxReceivedMessageSize

Postby hamej » Thu Feb 25, 2016 4:41 am

I forgot to list the web.config file. Here it is:

<?xml version="1.0"?>
<configuration>

<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>

<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>

<system.serviceModel>

<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>


<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

</system.serviceModel>

<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>


</configuration>

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: WCF maxReceivedMessageSize

Postby JS-Support @Userware » Thu Feb 25, 2016 12:02 pm

Thanks. We are going to look into it and I will keep you updated.

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: WCF maxReceivedMessageSize

Postby JS-Support @Userware » Fri Feb 26, 2016 10:56 am

Hi,

When creating your client in your CSHTML5 project, you can specify the MaxReceivedMessageSize.

Here is an example:

Code: Select all

Service1Client soapClient =
                new Service1Client(
                    new BasicHttpBinding()
                    {
                        MaxReceivedMessageSize = 2147483647,
                        MaxBufferPoolSize = 524288,
                        MaxBufferSize = 2147483647
                    },
                    new EndpointAddress(
                        new Uri("http://REPLACE-WITH-THE-URL-OF-YOUR-SERVICE/Service1.svc")));

Note: in the code above, you need to replace "Service1Client" with the name that you gave to your WCF client when you did "Add Service Reference". You also need to replace the URL.

Thanks.
Regards,
JS-Support

hamej
Posts: 37
Joined: Thu Oct 01, 2015 8:41 am

Re: WCF maxReceivedMessageSize

Postby hamej » Sun Mar 06, 2016 4:32 am

Thank you. Works!


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 46 guests

 

 

cron