I am self-hosting a OWIN Web API using these code snippets:
class Startup
{
public void Configuration(IAppBuilder appBuilder)
{
var config = new HttpConfiguration();
var route = config.Routes.MapHttpRoute("DefaultApi", "{controller}");
appBuilder.UseWebApi(config);
}
}
WebApp.Start<Startup>("http://localhost:8080")
I would like to run some code when my Web API service shuts down. I'm looking for something like HttpApplication.Application_End
, a Disposed
event, or a well-placed override void Dispose()
.
How do I run code when the Web API service shuts down?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…