Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better handling of disposal concerns when running inside IIS

  • Loading branch information...
commit a2e4f22abf68e90921887ef3c8c9b7f124188302 1 parent e02a812
@ayende ayende authored
View
1  Raven.Web/BootStrapper.cs
@@ -15,7 +15,6 @@ public void Init(HttpApplication context)
public void Dispose()
{
- ForwardToRavenRespondersFactory.Shutdown();
}
}
View
12 Raven.Web/ForwardToRavenRespondersFactory.cs
@@ -5,6 +5,7 @@
//-----------------------------------------------------------------------
using System;
using System.Web;
+using System.Web.Hosting;
using Raven.Database;
using Raven.Database.Config;
using Raven.Database.Server;
@@ -17,6 +18,15 @@ public class ForwardToRavenRespondersFactory : IHttpHandlerFactory
internal static HttpServer server;
private static readonly object locker = new object();
+ public class ReleaseRavenDBWhenAppDomainIsTornDown : IRegisteredObject
+ {
+ public void Stop(bool immediate)
+ {
+ Shutdown();
+ HostingEnvironment.UnregisterObject(this);
+ }
+ }
+
public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
{
if (database == null)
@@ -61,6 +71,8 @@ public static void Init()
}
throw;
}
+
+ HostingEnvironment.RegisterObject(new ReleaseRavenDBWhenAppDomainIsTornDown());
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.