I know that there are several other similar questions on this topic, but none of them seem to have an answer, so I thought that we all could do it here.
I have a WCF service running on my servers and am trying to send a status message when the server is closed by overriding "OnShutDown ()".
This can be seen as follows:
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(); }
This seems to work in about 50% of cases, while for the other 50% I get the following error:
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
Does anyone have any idea why this will happen?
source share