WCF 클라이언트 타임 아웃 렉션을 얻는 (그리고 연결을 닫고 있습니다)
-
23-08-2019 - |
문제
여기에 ...이 문제를 오랫동안 운이없이 일해 왔습니다.
IIS에서 호스팅 된 WCF 서비스가 있습니다 (콘솔 호스트에서도 시도했지만 동일한 동작을 얻었습니다). Scvutil을 통해 대리를 만들었습니다.
그러나 여기에 몇 가지 단서가 있습니다.
1- 테스트 환경에서만 발생합니다 (내 Dev 기계에서 호스팅 된 서비스가 아닌), 수치!
2- 서비스를 비동기식으로 호출합니다 (client.myserviceasync)
3- 이것은 가장 까다로운 것입니다 ... 내가 무슨 일이 일어나고 있는지 확인하기 위해 피들러를 실행하면 클라이언트가 작동하고 실패하지 않습니다.
나는 지금까지 무슨 일이 일어나고 있는지 전혀 실마리가 없다. 서버 (Win2003)에 추가 연결을 차단하는 일종의 "수비수"가 있다고 생각하기 시작했습니다. 가능할 수 있습니까? 전화 후에 고객을 닫을 때 저를 믿으십시오. 실제로 ascynchronous 통화를 사용하기 때문에 서버로부터 응답을받은 후에.
모든 팁이나 조언은 감사하는 것 이상입니다. 문안 인사,
편집 : 이것이 유용 할 수 있다고 생각했습니다. 정보 : 운이없이 양쪽 끝에서 추적을 가능하게했습니다.
서버 측에서 나는 연결이오고가는 것을 본다.
해결책 2
좋아, 누군가가 같은 문제에 직면 할 경우를 대비하여 문제를 해결하는 방법은 다음과 같습니다.
비동기식으로 불리는 저의 서비스는 스트림을 반환 하고이 스트림이 클라이언트에 폐기되지 않았으므로 프록시가 풀리지 않았습니다.
의견에 감사드립니다. 그들은 전에 들어 본 적이없는 새로운 것이 없기 때문에 솔루션으로 이끌었습니다.
다른 팁
최선의 방법은 클라이언트와 서비스를 모두 추적하여 제어 흐름을 볼 수 있도록하는 것입니다. 적어도 WCF가 취한 조치에 대한 가시성을 얻을 수 있습니다.
추적 활성화에 대한 정보는 다음과 같습니다.http://msdn.microsoft.com/en-us/library/ms733025.aspx
또한 클라이언트 측 및 서버 측 추적을 서비스 추적 뷰어 도구에로드하여 이벤트가 서로 상관되는 것을 볼 수 있습니다. 다음은 해당 도구에 대한 추가 정보와 출력을 읽는 방법입니다.http://msdn.microsoft.com/en-us/library/aa751795.aspx
이 도구는 이런 종류의 것을 디버깅하는 데 매우 중요합니다. 바라건대 당신은 바로 무슨 일이 일어나고 있는지 알 수 있기를 바랍니다.
필요한 정보를 여전히 볼 수 없다면 메시지 로깅을 시도 할 수도 있습니다 (서비스 추적 뷰어 도구도 해당 파일도 읽을 수 있습니다).
그래도 당신이 올바른 길을 가고 있다고 생각합니다. 그래도 연결이 제대로 닫히지 않는다고 생각합니다. 특히 비동기 작업의 경우 실현하지 않고 쉽게 수행 할 수 있습니다. 과거에 최종 요청이 발사되기 전에 고객 객체를 재현했을 때 이것은 나에게 일어났습니다. 이로 인해 나는 내가 닫았다 초 객체의 연결이지만 첫 번째는 아닙니다. 추적 시청자는 이것을 나에게 꽤 빨리 지적했습니다.
WCF는 서비스 조절을 지원합니다. 이를 통해 동시에 실행할 수있는 메시지/연결/인스턴스 수를 제한 할 수 있습니다. MSDN에서 Servicethrottle을 검색하십시오.
다음과 같은 앱 구성에서 ServiceThrottle을 지정합니다.
<behaviors>
<serviceBehaviors>
<behavior name="Throttled">
<serviceThrottling
maxConcurrentCalls="1"
maxConcurrentSessions="2200"
maxConcurrentInstances="1"
/>
</behavior>
</serviceBehaviors>
</behaviors>
스로틀 링이 문제라고 의심되는 경우 디버거 또는 덤프에서 Servicethrottle 객체를 찾으십시오. 다음은 덤프에서 CDB를 사용하는 예입니다.
덤프 서비스 호스트
0:000> !do 0000000001647fc0
Name: System.ServiceModel.ServiceHost
MethodTable: 000007feef98a7f0
EEClass: 000007feef352d60
Size: 248(0xf8) bytes
(D:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll)
Fields:
MT Field Offset Type VT Attr Value Name
000007fef23d5918 400098a 4c System.Boolean 1 instance 0 aborted
000007fef23d5918 400098b 4d System.Boolean 1 instance 0 closeCalled
000007feef93aa00 400098c 8 ...ct+ExceptionQueue 0 instance 0000000000000000 exceptionQueue
000007fef23d6038 400098d 10 System.Object 0 instance 0000000001648188 mutex
000007fef23d5918 400098e 4e System.Boolean 1 instance 0 onClosingCalled
000007fef23d5918 400098f 4f System.Boolean 1 instance 0 onClosedCalled
000007fef23d5918 4000990 50 System.Boolean 1 instance 1 onOpeningCalled
000007fef23d5918 4000991 51 System.Boolean 1 instance 1 onOpenedCalled
000007fef23d5918 4000992 52 System.Boolean 1 instance 0 raisedClosed
000007fef23d5918 4000993 53 System.Boolean 1 instance 0 raisedClosing
000007fef23d5918 4000994 54 System.Boolean 1 instance 0 raisedFaulted
000007fef23d5918 4000995 55 System.Boolean 1 instance 1 traceOpenAndClose
000007fef23d6038 4000996 18 System.Object 0 instance 0000000001647fc0 eventSender
000007feef929a60 4000997 48 System.Int32 1 instance 2 state
000007fef23ce158 4000998 20 System.EventHandler 0 instance 0000000000000000 Closed
000007fef23ce158 4000999 28 System.EventHandler 0 instance 0000000000000000 Closing
000007fef23ce158 400099a 30 System.EventHandler 0 instance 0000000001648660 Faulted
000007fef23ce158 400099b 38 System.EventHandler 0 instance 0000000000000000 Opened
000007fef23ce158 400099c 40 System.EventHandler 0 instance 0000000000000000 Opening
000007fef23d5918 4002e78 56 System.Boolean 1 instance 1 initializeDescriptionHasFinished
000007feef981300 4002e79 58 ...meKeyedCollection 0 instance 00000000016481a0 baseAddresses
000007feef981500 4002e7a 60 ...patcherCollection 0 instance 0000000001648220 channelDispatchers
000007fef2416b80 4002e7b c0 System.TimeSpan 1 instance 0000000001648080 closeTimeout
000007feef980e70 4002e7c 68 ...erviceDescription 0 instance 0000000001656e28 description
0000000000000000 4002e7d 70 0 instance 0000000001648290 extensions
0000000000000000 4002e7e 78 0 instance 0000000000000000 externalBaseAddresses
0000000000000000 4002e7f 80 0 instance 000000000166cf80 implementedContracts
000007feef989770 4002e80 88 ...nceContextManager 0 instance 0000000001648300 instances
000007fef2416b80 4002e81 c8 System.TimeSpan 1 instance 0000000001648088 openTimeout
000007feef8e9890 4002e82 90 ...rformanceCounters 0 instance 0000000000000000 servicePerformanceCounters
000007feef98b708 4002e83 98 ...rformanceCounters 0 instance 000000000171c590 defaultPerformanceCounters
000007feef981a18 4002e84 a0 ...r.ServiceThrottle 0 instance 0000000001648340 serviceThrottle
000007feef980c20 4002e85 a8 ...erviceCredentials 0 instance 0000000001800ed0 readOnlyCredentials
000007feef980d58 4002e86 b0 ...orizationBehavior 0 instance 0000000001801240 readOnlyAuthorization
0000000000000000 4002e87 b8 0 instance 0000000000000000 UnknownMessageReceived
000007fef53bc640 4002e77 f80 System.Uri 0 static 0000000001648110 EmptyUri
000007fef23d6038 40032cc d0 System.Object 0 instance 00000000015be070 singletonInstance
000007fef23d8420 40032cd d8 System.Type 0 instance 00000000016486a0 serviceType
000007feef981ee0 40032ce e0 ...ontractCollection 0 instance 0000000001657468 reflectedContracts
000007fef23d1000 40032cf e8 System.IDisposable 0 instance 0000000000000000 disposableInstance
ServiceHost의 스로틀 정보를 덤프하십시오
0:000> !do 0000000001648340
Name: System.ServiceModel.Dispatcher.ServiceThrottle
MethodTable: 000007feef981a18
EEClass: 000007feef34c2d8
Size: 72(0x48) bytes
(D:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll)
Fields:
MT Field Offset Type VT Attr Value Name
000007feef981a90 400371d 8 ...cher.FlowThrottle 0 instance 00000000016484a8 calls
000007feef981a90 400371e 10 ...cher.FlowThrottle 0 instance 00000000016485d8 sessions
000007feef902140 400371f 18 ...her.QuotaThrottle 0 instance 0000000000000000 dynamic
000007feef981a90 4003720 20 ...cher.FlowThrottle 0 instance 0000000001779f80 instanceContexts
000007feef9808c8 4003721 28 ...l.ServiceHostBase 0 instance 0000000001647fc0 host
000007fef23d5918 4003722 38 System.Boolean 1 instance 1 isActive
000007fef23d6038 4003723 30 System.Object 0 instance 0000000001648410 thisLock
덤프 세션 스로틀 정보
0:000> !do 00000000016485d8
Name: System.ServiceModel.Dispatcher.FlowThrottle
MethodTable: 000007feef981a90
EEClass: 000007feef34c390
Size: 64(0x40) bytes
(D:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll)
Fields:
MT Field Offset Type VT Attr Value Name
000007fef23dd9b8 40034f5 30 System.Int32 1 instance 2220 capacity
000007fef23dd9b8 40034f6 34 System.Int32 1 instance **2220 count
000007fef23d6038 40034f7 8 System.Object 0 instance 0000000001648618 mutex
000007fef23c4d70 40034f8 10 ...ding.WaitCallback 0 instance 0000000001648598 release
0000000000000000 40034f9 18 0 instance 0000000001648630 waiters
000007fef23d6748 40034fa 20 System.String 0 instance 00000000016483c8 propertyName
000007fef23d6748 40034fb 28 System.String 0 instance 0000000001648550 configName
0:000>