Page 1 of 1
WCF maxReceivedMessageSize
Posted: Thu Feb 25, 2016 4:34 am
by hamej
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.
Re: WCF maxReceivedMessageSize
Posted: Thu Feb 25, 2016 4:41 am
by hamej
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>
Re: WCF maxReceivedMessageSize
Posted: Thu Feb 25, 2016 12:02 pm
by JS-Support @Userware
Thanks. We are going to look into it and I will keep you updated.
Re: WCF maxReceivedMessageSize
Posted: Fri Feb 26, 2016 10:56 am
by JS-Support @Userware
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
Re: WCF maxReceivedMessageSize
Posted: Sun Mar 06, 2016 4:32 am
by hamej
Thank you. Works!