Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: fa6d0b533e
46 lines (41 sloc) 1.001 kb
using System;
using System.Diagnostics;
using System.Web.Hosting;
namespace SignalR.Hosting.AspNet
{
internal class AspNetShutDownDetector : IRegisteredObject
{
private readonly Action _onShutdown;
public AspNetShutDownDetector(Action onShutdown)
{
_onShutdown = onShutdown;
}
public void Initialize()
{
try
{
HostingEnvironment.RegisterObject(this);
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
public void Stop(bool immediate)
{
try
{
_onShutdown();
}
catch
{
// Swallow the exception as Stop should never throw
// TODO: Log exceptions
}
finally
{
HostingEnvironment.UnregisterObject(this);
}
}
}
}
Jump to Line
Something went wrong with that request. Please try again.