WCF를 이용해 DB 데이터를 가져오는 중에 아래의 내용의 Exception을 받았다.

 

{"들어오는 메시지의 최대 메시지 크기 할당량(65536)을 초과했습니다. 할당량을 늘리려면 적합한 바인딩 요소에서 MaxReceivedMessageSize 속성을 사용하십시오."}

 

 

 

해결 방법은 Client의 app.config파일에서 maxBufferSize와 maxReceivedMessageSize의 값을 올려주면 된다. 최대 int32.Max인 2147483646값으로 설정하였다.

 

 

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

    <system.serviceModel>

        <bindings>

            <basicHttpBinding>

                <binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"

                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

                    maxBufferSize="2147483646" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483646"

                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

                    useDefaultWebProxy="true">

                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />

                    <security mode="None">

                        <transport clientCredentialType="None" proxyCredentialType="None"

                            realm="" />

                        <message clientCredentialType="UserName" algorithmSuite="Default" />

                    </security>

                </binding>

            </basicHttpBinding>

        </bindings>

        <client>

            <endpoint address="http://localhost:61867/Service.svc" binding="basicHttpBinding"

                bindingConfiguration="BasicHttpBinding_IService" contract="ServiceReference1.IService"

                name="BasicHttpBinding_IService" />

        </client>

    </system.serviceModel>

</configuration>

 

+ Recent posts