public void Stop() { OnLog("SimpleServiceHost stopping..."); if (_serviceHost != null && _serviceHost.State != CommunicationState.Closed) { // Make sure, that allocated ressources gets released/disposed _serviceHost.Close(new TimeSpan(0, 0, 0, 5)); } _serviceHost = null; _serviceInstance.Close(); _serviceInstance = null; }