2012-02-17 3 views
2

호출자 (C# WPF 응용 프로그램)에 인스턴스화 된 객체 컬렉션을 전달하는 C#으로 작성한 WCF 서비스가 있습니다. 훌륭한 작품, 그러나 내가 반환하는 컬렉션에 너무 많은 개체가있는 경우 호출은 약 10 초 후 일반적인 측면에서 내부 예외가 포함 된 일반적인 예외 (약 10 초 후 클라이언트 쪽에서 실패합니다. 여기서, 예외 및 내부 예외이다.. http://myserver/MyAppService/MyAppService.svc에 HTTP 응답을 수신하면서 너무 많은 데이터가 전달되어 WCF 서비스 호출에 실패 했습니까?

은 { "오류가 발생 이것은이 도 때문일 수도 인해 으로 HTTP 프로토콜을 사용하지 않고 결합 서비스 엔드 포인트가 될 수 HTTP 요청 컨텍스트가 서버에 의해 중단되었습니다 (서비스가 종료되었을 수 있으므로 ) 자세한 내용은 자세한 내용은 서버 로그를 참조하십시오. "}
{"기본 연결이 닫혔습니다 : 수신시 예상치 못한 오류가 발생했습니다. "}
{ "전송 연결에서 데이터를 읽을 수 없습니다 : 기존 연결이 원격 호스트에 의해 강제로 닫혔습니다 . "}
은 {"기존 연결 강제 문제가 100 %가 재생 될 것이다 확실히 컬렉션의 크기, 그리고 콘텐츠와 관련된

} "원격 호스트에 의해 폐쇄되었다. 단일 컬렉션을 여러 개의 작은 컬렉션으로 나누어 한 번에 하나씩 전달하면 잘됩니다. 그들이 모두 함께 있고 컬렉션이 커질 때만 문제가됩니다.

클라이언트 쪽 app.config 파일의 maxReceivedMessageSize 속성을 2147483647로 늘려 보았지만 오류가 계속 발생합니다. 또한 타임 아웃 기간을 늘리려고했지만 영향은 없습니다. 다음은 app.config 파일의 속성입니다. 나는 2147483647에 아래 거의 모든 수를 시도 증가없는 한 0으로 maxBufferPoolSize을 변경 시도,하지만 운 :

<bindings> 
    <basicHttpBinding> 
    <binding name="BasicHttpBinding_iMyAppService" 
     closeTimeout="01:00:00" openTimeout="01:00:00" 
     receiveTimeout="01:00:00" sendTimeout="01:00:00" 
     allowCookies="false" bypassProxyOnLocal="false" 
     hostNameComparisonMode="StrongWildcard" 
     maxBufferSize="2147483647" maxBufferPoolSize="524288" 
     maxReceivedMessageSize="2147483647" 
     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> 
    <wsHttpBinding> 
    <binding name="WSHttpBinding_iMyAppService" 
     closeTimeout="00:01:00" openTimeout="00:01:00" 
     receiveTimeout="00:10:00" sendTimeout="00:01:00" 
     bypassProxyOnLocal="false" transactionFlow="false" 
     hostNameComparisonMode="StrongWildcard" 
     maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" 
     messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
     allowCookies="false"> 
     <readerQuotas 
      maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <reliableSession ordered="true" inactivityTimeout="00:10:00" 
     enabled="false" /> 
     <security mode="Message"> 
     <transport clientCredentialType="Windows" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="Windows" negotiateServiceCredential="true" 
      algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<client> 
    <endpoint name="CurrencyConvertorSoap" 
     address="http://www.webservicex.net/CurrencyConvertor.asmx" 
     binding="basicHttpBinding" 
     bindingConfiguration="CurrencyConvertorSoap" 
     contract="CurrencyConverterService.CurrencyConvertorSoap" /> 

    <endpoint name="CurrencyConvertorSoap12" 
     address="http://www.webservicex.net/CurrencyConvertor.asmx" 
     binding="customBinding" 
     bindingConfiguration="CurrencyConvertorSoap12" 
     contract="CurrencyConverterService.CurrencyConvertorSoap" /> 

    <endpoint name="WSHttpBinding_iMyAppService" 
     address="http://myserver/MyAppService/MyAppService.svc" 
     binding="wsHttpBinding" 
     bindingConfiguration="WSHttpBinding_iMyAppService" 
     contract="MyAppService.iMyAppService" > 
    <identity> 
     <dns value="localhost" /> 
    </identity> 
    </endpoint> 

    <endpoint name="BasicHttpBinding_iMyAppService" 
     address="http://myserver/MyAppService/MyAppService.svc" 
     binding="basicHttpBinding" 
     bindingConfiguration="BasicHttpBinding_iMyAppService" 
     contract="MyAppService.iMyAppService" /> 
</client> 

내가 다른 무엇을 변경하거나이 작품을 만들기 위해 추가 할 수 있습니다?

감사합니다.

답변

2

maxitemsinobjectgraph 일 수 있습니다. wcf 추적을 활성화하면 거기에 스택 추적이 표시됩니다.

+0

Darn ... 나는 당신의 응답을 읽을 때 그것이 정말로 희망적 이었지만, 불행히도 안된다. 만약 내가 제대로하지 않으면. 하지만 내의 app.config이 추가 : <동작 이름 = "Behaviors.EndpointBehavior"> 다음이 및 내 종점 선 : behaviorConfiguration = "Behaviors.EndpointBehavior"하지만 다시 불행하게도 작동하지 않았습니다. 같은 오류. 그래도 도움을 주셔서 감사합니다. – Nullqwerty

+1

필자는 내 PC가 아니지만 호스트 * 및 * 클라이언트에서 설정을해야한다고 확신합니까? 그것을 시도 했습니까 (이것은 @ felan의 설정에서도 동일합니다). –

+0

나는 Felan의 제안을 시도했지만, 불행히도 그것을 고쳐주지는 못했다. maxitemsinobjectgraph에 대한 동작을 서버 측 web.config에 추가하려고 시도했지만 그 작업은 수행하지 않았습니다. 나는 Felan을 서버 측에 추가 할 수 없었습니다. 왜냐하면 web.config에는 어디에도 옵션이 없었기 때문에 어디에 넣을 지 잘 모릅니다. – Nullqwerty

2

필자도 비슷한 상황에서 maxArrayLength를 늘려야 만했다.

+0

나는 그것을 2147483647까지 증가 시키려고했지만 같은 오류가 발생했습니다. 어쨌든 고마워. – Nullqwerty

+1

maxStringContentLength = "8192"를 늘려야 할 수도 있습니다. 그러면 maxArrayLength를 크게 만들지 않을 것입니다. – Felan

+0

시도 ... 안타깝게도 안됩니다. 그래도 고마워. – Nullqwerty