프레임 워크가 관리하는 스레드 (예 : 내 스레드가 아님)에서 예외가 발생한 ASP.NET 응용 프로그램을 디버깅하는 데 4 시간 (영국에서 오전 3시)이 걸렸습니다. 방금 정적 메서드 ChannelFactory.CreateChannel의 결과를 IClientChannel에 캐스팅하고 명시 적으로 Disposed라는 사실을 알았습니다. 제 말은 괜찮습니다. 그러나 이유는 무엇입니까?IClientChannel 반 패턴
1) ChannelFactory.CreateChannel은 out 매개 변수로 IClientChannel을 반환하지 않습니까?
2) CreateChannel 용 .Net 설명서에 언급되지 않았습니까?
3) .NET 설명서에 예제 (코드 없음)의 적절한 사용 패턴이 표시되지 않습니까?
틀리게하지 마세요. 닷넷 프레임 워크를 좋아해요. Microsoft (및 Krzysztof Cwalina : Designing Framework Guidelines 참조)는 정말 훌륭한 작업을 수행했습니다. 그래서 나는 그런 재앙을 기대하지 않았다. 내 IMyService 변수도 IClientChannel을 지원한다는 것을 알고 있어야하며 명시 적으로 처리해야합니다.
누군가가 관심이 있다면 여기에 ASP.NET 로그가 있습니다.
Event Type: Error
Event Source: ASP.NET 2.0.50727.0
Event Category: None
Event ID: 1334
Date: 12/08/2009
Time: 01:55:47
User: N/A
Computer: WLGH3GIS
Description:
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/1/Root/Maps
Process ID: 3044
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
StackTrace: at System.Threading.Overlapped.Free(NativeOverlapped* nativeOverlappedPtr)
at System.ServiceModel.Channels.OverlappedContext.Free()
at System.ServiceModel.Channels.PipeConnection.CloseHandle(Boolean abort, String timeoutErrorString, TransferOperation transferOperation)
at System.ServiceModel.Channels.PipeConnection.Close(TimeSpan timeout)
at System.ServiceModel.Channels.BufferedConnection.Close(TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionPool.CloseItem(IConnection item, TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationPool`2.EndpointConnectionPool.CloseItem(TItem item, TimeSpan timeout)
at System.ServiceModel.Channels.IdlingCommunicationPool`2.IdleTimeoutEndpointConnectionPool.CloseItem(TItem item, TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationPool`2.EndpointConnectionPool.CloseIdleConnection(TItem connection, TimeSpan timeout)
at System.ServiceModel.Channels.IdlingCommunicationPool`2.IdleTimeoutEndpointConnectionPool.IdleTimeoutIdleConnectionPool.OnIdle()
at System.ServiceModel.Channels.IdlingCommunicationPool`2.IdleTimeoutEndpointConnectionPool.IdleTimeoutIdleConnectionPool.OnIdle(Object state)
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2()
at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke()
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks()
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state)
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
Karol, FAQ를 읽은 다음 질문으로 다시 말하십시오 (그리고 아마도 답변도 게시하십시오). –