WCF 응답 메시지는 40 분이 걸리고 시간 초과 예외가 발생하지 않습니다.

StackOverflow https://stackoverflow.com/questions/1207770

  •  05-07-2019
  •  | 
  •  

문제

IIS7에서 호스팅 된 WCF 서비스가 있습니다 (서비스 및 클라이언트 구성은이 게시물의 끝에 있습니다). 나는 누군가가 그것을 공격하고 해결책을 찾는 방법에 대한 아이디어를 갖기를 바랐던 이상한 시나리오를 가로 질러 달렸다.

이 서비스는 하나의 계약 인 'ProcessMessage'만 노출됩니다. 예상 성능에 따라 해당 계약을 사용하여 서비스에서 동기 메시지를 보내거나받을 수 있지만 해당 계약에 대한 특정 호출은 65KB 이상의 데이터를 반환합니다. 약 1MB. 원래 호출했을 때 예상되는 Max 수신 크기를 초과 한 오류를 받았습니다. 그래서 나는 MaxReceivedMessagesize를 늘 렸으며 이제이 특정 호출은 고객에게 돌아가려면 40 분이 걸립니다. 이것은 타임 아웃 설정을 훨씬 뛰어 넘고 내가 기대할 것으로 예상되는 것 이상입니다. 서버 측 처리 시간은 단지 2 초입니다. 클라이언트 측에서 유지되는 것으로 보입니다.

또한 파일의 다른 할당량 중 몇 가지를 부딪치지 않았습니다.

어떤 생각도 대단히 감사 할 것입니다. 감사.

서비스 구성 :

  <system.serviceModel>
<services>
  <service behaviorConfiguration="Lrs.Esf.Facade.Startup.FacadeBehavior"
    name="Lrs.Esf.Facade.Startup.FacadeService">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="default" contract="Lrs.Esf.Facade.Startup.IFacadeService">
      <identity>
        <servicePrincipalName value="lrsdomain/PensionDev" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<bindings>
  <wsHttpBinding>
    <binding name="default">
      <security mode="None"/>
    </binding>
  </wsHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="Lrs.Esf.Facade.Startup.FacadeBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true" />

    </behavior>
  </serviceBehaviors>
</behaviors>

클라이언트 구성 :

  <system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="WSHttpBinding_IFacadeService" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:1:00" sendTimeout="00:01:00"
        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="52428800" maxReceivedMessageSize="6553600"
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
        allowCookies="false">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
          maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="None">          
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="http://esf2.facade.testpe.pg.local/FacadeWcf/FacadeService.svc"
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFacadeService"
      contract="FacadeServiceReference.IFacadeService" name="WSHttpBinding_IFacadeService">
    <identity>
      <servicePrincipalName value="lrsdomain/PensionDev" />
    </identity>
  </endpoint>
</client>

도움이 되었습니까?

해결책 2

나는이 문제의 기본 원인과 해결 방법을 알아 냈지만 추가적인 통찰력이 좋을 것입니다.

데이터 세트는 WCF에 의해 XML 형식으로 직렬화되었습니다. 데이터 세트가 바이트 []로 직렬화되고 시간이 4 초로 줄어 듭니다. 한 가지 추측은 HTTP 커뮤니케이션이 유효하도록 XML의 4MB에서 모든 캐릭터를 피하는 것이 문제를 일으킨다는 것입니다.

다른 팁

서버 측에서 다양한 매개 변수의 크기를 늘리지 않았습니다. 반드시 시도해야합니다! 서버 측의 클라이언트 구성 파일의 바인딩 구성을 사용하십시오. 서비스는 여전히 64K 메시지 크기로 기본값이므로 질식 할 수 있습니다.

또한, receiveTimeout 클라이언트 바인딩에서 약간 재미 있습니다. 제로 숫자가 없습니다.

<binding name="WSHttpBinding_IFacadeService" 
receiveTimeout="00:1:00" 

당신은 사용해야합니다 receiveTimeout="00:01:00"

마크

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top