2012-03-22 3 views
4

이 주제에 대한 비슷한 질문이 몇 가지 있습니다.하지만 그 중 아무 것도 대답이없는 것 같아서 여기에 모두 해싱 할 수 있다고 생각했습니다.WCF 서비스 중 OnShutDown()

내 서버에서 WCF 서비스가 실행 중이며 "OnShutDown()"을 재정 의하여 서버가 종료 될 때 상태 메시지를 보내려고합니다.

System.ServiceModel.Security.SecurityNegotiationException: Could not establish secure   channel for SSL/TLS with authority '"ENDPOINT ADDRESS REMOVED'. --->  System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel. 
    at System.Net.HttpWebRequest.GetResponse() 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitF orReply(TimeSpan timeout) 
--- End of inner exception stack trace --- 

Server stack trace: 
    at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebExceptoon webException, HttpWebRequest request, HttpAbortReason abortReason) 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) 
    at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 

Exception rethrown at [0]: 
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
    at Ascertain.AscertainAgent.IService.updateInvStatus(String hostNM, String invValue) 
    at Ascertain.AscertainAgent.ServiceClient.updateInvStatus(String hostNM, String invValue) in C:\Users\daladd\Documents\CS\Ascertain\Ascertain\Ascertain\Service References\AscertainAgent\Reference.cs:line 209 
    at Ascertain.Service1.OnShutdown() in  "FILE LOCATION REMOVED"\Service1.cs:line224 

사람이 어떤이 있습니까 :

 protected override void OnShutdown() 
      { 
       try 
       { 
        client.updateInvStatus(machineName, "Client Host Has Shutdown"); 
       } 
       catch (Exception ex) 
       { 
        EH.writeToErrorLog("||OnShutdown||Error Shutting Down System \r\n" + ex); 

       } 
       base.OnShutdown(); 
      } 

이 시간의 약 50 %, 나는 다음과 같은 오류를 얻을 다른 50 %를 작동하는 것 같다 다음과 같이

볼 수 있습니다 왜 이런 일이 일어날까요?

+0

그냥 추측하지만 경쟁 조건입니까? 서버가 종료되었다는 것을 모든 사람에게 알리기 위해 메시지를 보낼 수있는 것보다 빨리 종료되고 있습니까? 아마도 최종 메시지를 보낸 후 지연이 도움이 될 수 있습니까? –

+0

서비스 요청이 종료되기 전에 더 많은 시간을 요구하지만 Microsoft는 Vista 이후이 기능을 크게 제한했습니다. 이것은 절대적으로 문제가 될 수 있지만 나는 그 경우 시간의 100 %를 실패 할 것이라고 생각합니다. – vesuvious

+0

이 반드시 그런 것은 아니기 때문에 경쟁 조건이라고합니다. –

답변

0

이것은 종료 시간과 관련 될 수 있습니다. 종료가 너무 오래 걸리면 프로세스가 종료됩니다. 이것은 당신에게 일어날 수 있습니다.

여기에 제한 시간을 늘려보십시오 :

HKEY_LOCAL_MACHINE을 \ 시스템 \ CURRENTCONTROLSET을 Contro 리터 \ \는 프로세스가 살해당한 것을 말하는 이벤트 로그에 이벤트가있을 수 있습니다

을이 WaitToKillServiceTimeout.

1

윌리엄 (Wily) 박사의 말에 뒤늦게 끝났습니다. 내 연결을 유지하고 지금 코드가 매번 작동합니다 추가했습니다. 기본적으로 Windows는 OnShutDown() 메서드 중 새 연결을 열지 않으므로 연결 시간이 초과되면 제대로 작동하지 않습니다.

이 방법을 사용하면 내 중앙 서버에 2000 개의 영구 연결이 있기 때문에 누구나이 아이디어가 여전히 유용 할 것입니다. Shiraz, 더 긴 타임 아웃을 허용하기 위해 레지스트리 키를 변경하려고했으나 시간이 문제가되지 않았습니다.

관련 문제