我知道在这个主题上还有一些其他类似的问题,但是它们似乎都没有答案,所以我想我们都可以在这里哈希.
我在我的服务器上运行了WCF服务,并且我试图通过覆盖“OnShutDown()”来关闭服务器时发送状态消息.
这可以看作如下:
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%我得到以下错误:
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
有没有人有任何想法为什么会发生这种情况?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。