-
Notifications
You must be signed in to change notification settings - Fork 311
IApplicationLifetime ApplicationStopping does not trigger if ConfigureServices method exists #151
Comments
Related: aspnet/HttpSysServer#71 |
Is it? It happens when use kestrel. Seems like a bug in hosting |
On Mono, Kestrel throws an Exception during its |
I'm not sure that's even related, when you remove ConfigureServices, the text |
Here's my workaround: using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Framework.DependencyInjection;
namespace WebApplication52
{
public class Startup
{
public void ConfigureServices(IServiceCollection services, IApplicationLifetime lifetime)
{
services.AddInstance(lifetime);
}
public void Configure(IApplicationBuilder app, IApplicationLifetime lifetime)
{
lifetime.ApplicationStopping.Register(OnStuff);
}
public void OnStuff()
{
Console.WriteLine("Goodbye!");
}
}
} |
okay. Actually these are all problems related to app shutdown . |
This is specifically related to the fact that something is going bonkers when services are applied. I don't think this has to do with app shutdown per se as everything is functioning. It feels like its triggering the event on some bogus ApplicationLifetime service, rather than the one I'm using. Which is why the above code seems to work. |
Looks like the case. I can see a difference in the |
Fixed 718d923 |
I spent a good few hours trying to track this down on mono and it seems like it happens on windows as well.
The above code will not print out goodbye.
The text was updated successfully, but these errors were encountered: