diff --git a/Rhino.ServiceBus/Hosting/RemoteAppDomainHost.cs b/Rhino.ServiceBus/Hosting/RemoteAppDomainHost.cs index 6bcb9ff..68476b6 100644 --- a/Rhino.ServiceBus/Hosting/RemoteAppDomainHost.cs +++ b/Rhino.ServiceBus/Hosting/RemoteAppDomainHost.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using log4net; namespace Rhino.ServiceBus.Hosting { @@ -109,6 +110,7 @@ protected class HostedService private readonly IApplicationHost hoster; private readonly string assembly; private readonly AppDomain appDomain; + private readonly ILog log = LogManager.GetLogger(typeof (HostedService)); public HostedService(IApplicationHost hoster, string assembly, AppDomain appDomain) { @@ -120,7 +122,15 @@ public HostedService(IApplicationHost hoster, string assembly, AppDomain appDoma public void Stop() { hoster.Dispose(); - AppDomain.Unload(appDomain); + try + { + AppDomain.Unload(appDomain); + } + catch (Exception e) + { + log.Error( + "Could not unload app domain, it is likely that there is a running thread that could not be aborted", e); + } } public void Start()