2011-01-29 4 views
4

우리는 WCF에서 서비스 방법에 큰 XML 문자열을 보내려고 우리가 오류WCF 구성 maxStringContentLength는

최대 문자열 콘텐츠 길이 할당량 (8192를 받고있어 작동하지 않는 것)가 초과되었습니다. XML 데이터를 읽는 중입니다. 우리는 클라이언트 측 또는 서버 측 또는 두 가지 모두에이 작업을 수행하기로했다 경우에 우리는 확실하지 않았다하더라도

오류는 maxstringcontentlength을 증가 제안합니다. 우리는 둘 다 시도했지만 오류는 여전히 발생하는 것 같습니다. 아래에 클라이언트와 서비스 설정을 게시하겠습니다. 나는이 중 하나 또는 둘 모두가 작동하지 못하게하는 데 문제가 있다고 가정하고 있습니다.

제안 사항?

클라이언트 :

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="BasicHttpBinding_ITESTService" 
       closeTimeout="00:01:00" openTimeout="00:01:00" 
       receiveTimeout="00:10:00" sendTimeout="00:01:00" 
       allowCookies="false" bypassProxyOnLocal="false" 
       hostNameComparisonMode="StrongWildcard" 
       maxBufferSize="65536" maxBufferPoolSize="524288" 
       maxReceivedMessageSize="65536" 
       messageEncoding="Text" textEncoding="utf-8" 
       transferMode="Buffered" useDefaultWebProxy="true"> 
       <readerQuotas maxDepth="32" maxStringContentLength="2147483647" 
        maxArrayLength="2147483647" maxBytesPerRead="4096" 
        maxNameTableCharCount="2147483647" /> 
       <security mode="None" /> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint name="BasicHttpBinding_ITESTService" 
      address="http://localhost/TESTService.svc" 
      binding="basicHttpBinding" 
      bindingConfiguration="BasicHttpBinding_ITESTService" 
      contract="TESTService.ITESTService" /> 
    </client> 
</system.serviceModel> 

서버 :

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding 
       name="BasicHttpBinding_Service1" 
       maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
      <readerQuotas maxDepth="32" 
       maxStringContentLength="2147483647" maxArrayLength="2147483647" 
       maxBytesPerRead="4096" maxNameTableCharCount="2147483647" /> 
      <security mode="None" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service name="TESTService"> 
      <endpoint name="BasicHttpBinding_Service1" 
       address="http://localhost/TESTService.svc" 
       binding="basicHttpBinding" 
       bindingConfiguration="BasicHttpBinding_Service1" 
       contract="ITESTService" /> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 

답변

0

thread 올바르게 MaxStringContentLength을 변경하기 위해 서버와 클라이언트의 바인딩 설정을 지정하는 방법에 대해 자세히 설명이.

이 다른 thread도 readerQuotas 사용에 대한 명확하고 효율적인 대답을 제공합니다.

2

이름이 지정되지 않은 '기본'바인딩을 추가해보십시오. readerQuota 설정을이 바인딩에 추가하십시오.

실제로 사용중인 명명 된 바인딩에서 readerQuota 설정을 제거 할 수도 있습니다.

1

'기본'바인딩 옵션은 나를 위해 일한 (바인딩 이름을 올바른에 readerQuotas가 WCF에 의해 무시하는 이유를 잘 모르겠어요하지만) 날 위해 일했습니다. 명명 된 WebHttpBinding에서 maxStringContentLength 값을 사용자 지정하려고했지만 어떤 이유로 WCF에 의해 선택되지 않았습니다. 마침내 저는 D.Tiemstra 작업을 따라 작업을 시작했습니다.

<webHttpBinding>   
    <binding maxReceivedMessageSize="2147483647" > 
     <readerQuotas maxDepth="2147483647" 
     maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" 
     maxBytesPerRead="2147483647" 
     maxNameTableCharCount="2147483647" /> 
    </binding> 
    </webHttpBinding> 
+0

내가없는이 최대 값이 정확하지, 내가 함께 갈 것입니다 : '가 MaxBufferSize = 2147483647, MaxBufferPoolSize = 524,288, MaxReceivedMessageSize = 2147483647, ReaderQuotas이 새로운 XmlDictionaryReaderQuotas = { MAXDEPTH = 32,,MaxStringContentLength = 8192, MaxArrayLength = 16384, MaxBytesPerRead = 4096, MaxNameTableCharCount = 1638 } – DanielV

1

내가 (프로그램)을 WCF 구성에 대해이 값을 사용합니다 :

Security = { Mode = SecurityMode.None}, 
CloseTimeout = TimeSpan.MaxValue, 
OpenTimeout = TimeSpan.MaxValue, 
SendTimeout = TimeSpan.FromMinutes(5), 
ReceiveTimeout = TimeSpan.FromMinutes(5), 
MaxBufferSize = 2147483647, 
MaxBufferPoolSize = 524288, 
MaxReceivedMessageSize = 2147483647, 
ReaderQuotas = new XmlDictionaryReaderQuotas 
{ 
    MaxDepth = 32, 
    MaxStringContentLength = 8192, 
    MaxArrayLength = 16384, 
    MaxBytesPerRead = 4096, 
    MaxNameTableCharCount =1638 
}