Click here to Skip to main content
15,886,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a WCF Service Library Project for Duplex Communication, and a Windows Forms Application for testing with service reference to WCF Project.

All Works ok, but when WCF Service try to respond with 136.500 bytes of data, I get error 413 "Request Entity Too Large."

WCF Service Library App.Config

XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    </appSettings>
    <system.web>
        <compilation debug="true" />
    </system.web>
    <system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
                <binding name="WSDualHttpBinding_IPublisher" closeTimeout="00:10:00" maxBufferPoolSize="2147483646" receiveTimeout="00:10:00" messageEncoding="Text">
                    <readerQuotas maxArrayLength="2147483646" maxStringContentLength="2147483646" maxDepth="32"/>
                    <security mode="None" />
                </binding>
            </wsDualHttpBinding>
        </bindings>
        <services>
            <service name="DataService.Publisher">
                <endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IPublisher" contract="DataService.IPublisher">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8733/Design_Time_Addresses/DataService/Publisher/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior>
                    <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
                    <serviceDebug includeExceptionDetailInFaults="True" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
</configuration>


Windows Forms Application (for Testing) App.Config

XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
    </startup>
    <system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
                <binding name="WSDualHttpBinding_IPublisher" closeTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" receiveTimeout="00:10:00" messageEncoding="Text">
                    <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" maxDepth="32"/>
                    <security mode="None" />
                </binding>
            </wsDualHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:8733/Design_Time_Addresses/DataService/Publisher/" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IPublisher" contract="PublisherService.IPublisher" name="WSDualHttpBinding_IPublisher">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>


My Callback Class in Client Application has attribute:

C#
<CallbackBehavior(UseSynchronizationContext:=False,
                  IncludeExceptionDetailInFaults:=True,
                  MaxItemsInObjectGraph:=2147483646,
                  ValidateMustUnderstand:=False)>


Testing:
•Callback with 672 bytes: Ok
•Callback with 2.779 bytes: Ok
•Callback with 136.500 bytes: Error



Thanks and sorry for my english...

What I have tried:

I try other configurations (maxAllowedContentLength, uploadReadAheadSize, ...) in Client app.config (and WCF Service too) like system.web, system.webserver, http-runtime, ...
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900