public bool Handle(Exception exception, ChannelDispatcher dispatcher, WCFServiceController wcfServiceController) { if (this.pendingRestart) { return false; } if (!(exception is CommunicationException)) { AcceptedErrorLimitation.Add(exception); if (AcceptedErrorLimitation.ExceedLimit()) { AutoRestartLimitation.Add(exception); if (AutoRestartLimitation.ExceedLimit()) { _logger.LogWarning("Unable solve exception with configured max-times of WCF Service restart." + string.Format( "WCF Servuce {0}, Times of Auto-Restart has exceed the max value within configued time range, waiting window service restart", wcfServiceController.ServiceName)); this.pendingRestart = true; return false; } else { AcceptedErrorLimitation.ResetCount(); return Handle(wcfServiceController); } } } return true; }
public bool Handle(Exception exception, ChannelDispatcher dispatcher, WCFServiceController wcfServiceController) { _logger.LogError("WCF Service unhandled exception", exception); return true; }
private bool Handle(WCFServiceController wcfServiceController) { _logger.LogInfo("Queue up restart WCF Service" + string.Format("Queue to restarting WCF Service, Service name: {0}", wcfServiceController.ServiceName)); ThreadPool.QueueUserWorkItem( delegate(object state) { wcfServiceController.Restart(); _logger.LogInfo("Restarted WCF Service" + string.Format("Restarted WCF Service, Service name: {0}", wcfServiceController.ServiceName)); }); return true; }