2011-03-17 2 views
2

일부 사용자 지정 개체와 바이트 배열로 전송 된 여러 문서를 허용하는 WCF 웹 서비스가 있습니다.WCF WS throwing MaxReceivedMessageSizeExceeded

하지만 (특히 큰 것은 아니지만) 문서를 보낼 때마다 WS는 400 번의 잘못된 요청을 보내고 추적 로그에는 MaxReceivedMessageSizeExceeded을 던진 것처럼 보입니다. 는

System.ServiceModel.ProtocolException 이르되 수신 메시지 (65536)의 최대 메시지 크기 할당량이되었습니다 를 초과했습니다. 할당량을 늘리려면 의 MaxReceivedMessageSize 속성을 적절한 바인딩 요소로 사용하십시오.

이제 클라이언트 응용 프로그램은 내가만큼 지금까지 내가를 볼 수 분명히 내가 뭔가를 놓친 거지이

<service behaviorConfiguration="WCFReferrals.Service1Behavior" 
     name="WCFReferrals.Referrals"> 
    <endpoint address="" binding="wsHttpBinding" contract="WCFReferrals.IReferrals"> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
    </endpoint> 
    <endpoint address="mex" binding="wsHttpBinding" contract="IMetadataExchange" /> 
</service> 
.... 
<binding name="wsHttpBinding" maxBufferPoolSize="2147483647" 
      maxReceivedMessageSize="2147483647"> 
    <readerQuotas maxDepth="32" maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" maxBytesPerRead="4096" 
      maxNameTableCharCount="16384" /> 
</binding> 

이 그 app.config

<wsHttpBinding> 
    <binding name="WSHttpBinding_IReferrals" 
     closeTimeout="00:01:00" openTimeout="00:01:00" 
     receiveTimeout="00:10:00" sendTimeout="00:01:00" 
     bypassProxyOnLocal="false" transactionFlow="false" 
     hostNameComparisonMode="StrongWildcard" 
     maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
     messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
     allowCookies="false"> 
     <readerQuotas maxDepth="32" 
      maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 

에와 WCF web.config이있다 최대 메시지 제한이 필요한 것에 대해 waaaaay를 설정하십시오.

도움 말 행복

감사

모든

NAT

답변

2

먼저받은 수 ULD : 서버 측에서, 당신은 큰 메시지 크기와 바인딩 구성을 정의 ,하지만 당신은에서에게 그것을 을 참조하지 마십시오 엔드 포인트.

<service behaviorConfiguration="WCFReferrals.Service1Behavior" 
     name="WCFReferrals.Referrals"> 
    <endpoint 
     address="" 
     binding="wsHttpBinding" 
     bindingConfiguration="LargeSizeMessages" <== you need to reference the binding config (by specifying its name 
     contract="WCFReferrals.IReferrals"> 
    </endpoint> 
    ..... 
    </service> 
    .... 
    <binding name="LargeSizeMessages" <== give it a meaningful name 
     maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 
     <readerQuotas maxDepth="32" maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" maxBytesPerRead="4096" 
      maxNameTableCharCount="16384" /> 
    </binding> 

기타 : 클라이언트 쪽에서도 동일한 작업을 수행하고 있습니까? 클라이언트 쪽 구성 (app.config 또는 web.config)에도 큰 메시지 크기 바인딩 구성이 포함되어 있습니까? 당신은 귀하의 <client> .. <endpoint> 요소에 바인딩 구성을 참조하는거야 ??

+1

완전히 새로운 내용으로 치료를 받았습니다. 나는 바인딩 속성이 당신이 원하는 바인딩을 지적했다고 생각했다. 바인딩 구성이 아닙니다. 정말 대단히 감사합니다. – nat

+0

@nat : 단일 바인딩에 대해 몇 가지 바인딩 구성을 가질 수 있습니다. 그 이유는 이름으로 엔드 포인트에 대해 원하는 바인딩을 참조해야하기 때문입니다 –

관련 문제