2013-11-28 3 views
0

WCF 신뢰할 수있는 세션을 사용하여 서비스에서 클라이언트로 콜백을 사용하려고합니다. 이 콜백 채널은 무기한 열어야합니다.구성된 시간 제한에 관계없이 WCF 신뢰할 수있는 세션 오류

일부 .NET 버전에는 reliable sessions fault prematurely을 허용하는 버그가있는 것으로 보입니다. 문제가되지 않으면 inactivityTimeout 및 receiveTimeout을 충분히 높은 값 (예 : TimeSpan.MaxValue)으로 설정하면됩니다.

하지만 내 클라이언트와 서비스를 어떻게 구성하든 관계없이 제한 시간으로 설정 한 값에 관계없이 10 분 후에도 채널에 오류가 발생합니다. 당신이 10 분보다, 모든 시간 제한 값으로 구성되어 높은 볼 수 있듯이, 그래서

<!-- service's app.config --> 
<!-- irrelevant stuff snipped .. --> 
</binding> 
    <netTcpBinding> 
    <!-- enable reliable sessions, set timeouts to their maximum possible value!!! --> 
    <binding name="netTcpReliable" receiveTimeout="infinite"> 
     <reliableSession enabled="true" inactivityTimeout="infinite"/> 
    </binding> 
    </netTcpBinding> 
</binding> 

<services> 
    <service name="SomeService" behaviorConfiguration="metadataBehavior"> 
    <host> 
     <baseAddresses> 
     <add baseAddress="net.tcp://localhost:port/SomeService"/> 
     </baseAddresses> 
    </host> 
    <endpoint name="SomeService_BasicTcpEndpoint" 
       address="service" 
       binding="netTcpBinding" 
       bindingConfiguration="netTcpReliable" 
       contract="ISomeService" /> 
    </service> 
<services> 

// client's binding generation code 
var binding = new NetTcpBinding(SecurityMode.Transport, true) // enable reliable session 
{ 
    OpenTimeout = openCloseTimeout, 
    CloseTimeout = openCloseTimeout, 
    SendTimeout = sendTimeout, 
    ReceiveTimeout = TimeSpan.MaxValue // maximum possible value (infinite in app.config) 
}; 

binding.ReliableSession.InactivityTimeout = TimeSpan.MaxValue; // maximum possible value (infinite in app.config) 

var factory = new ChannelFactory<TChannel>(binding); 
return factory.CreateChannel(endpointAddress); 

, 그리고 :

이 질문은 그래서 여기 간다, 내 설정없이 불완전 할 것이다 서비스 호출없이 10 분이 지나면 채널 오류가 발생합니다. 어떻게 이것을 피할 수 있습니까? 내가 이해할 수있는 한, 신뢰할 수있는 세션은 (다른 것들 중에서) 정확하게 채널을 유지하고 채널을 유지하면서 (인프라를 유지하면서 인프라 스트럭처를 유지함으로써 - aforementioned bug이없는 최근 .NET 버전에서).

+0

나는 이것이 거의 1 년 된 것을 알고 있습니다. 그러나 클라이언트와 서버 모두에서이 값을 설정 했습니까? –

답변

0

컴파일하는 동안 infinite가 시간 초과에 대한 합법적 인 값이 아니라는 경고를 받았어야합니다. 최대 시간 초과는 약 24 일입니다.

+0

기술적으로, 무한을 TimeSpan.MaxValue로 해석하는 특수한 설정 시리얼 라이저가 있습니다.하지만 MaxValue를 사용하여 코드의 값을 오버라이드하여도 사용자의 의견은별로 도움이되지 않습니다. –