aspnet / Hosting

[Archived] Code for hosting and starting up an ASP.NET Core application. Project moved to https://github.com/aspnet/Extensions and https://github.com/aspnet/AspNetCore
Apache License 2.0
552 stars 312 forks source link

IHostedService won't start automatically on IIS even if preload enabled #1557

Closed Ldoppea closed 5 years ago

Ldoppea commented 5 years ago

Hi,

I'm working on a .Net Core Web Api that uses a IHostedService. But I struggle on making it start automatically after a windows reboot.

I implemented the IHostedService as explained here : https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-2.1

When debugging then everything works fine.

I deployed it on a Windows Server 2012 R2 running IIS 8.5.

The IIS is configured with :

When I restart the server or if I do a iisreset, then the application won't start automatically. The only way to start it is to call one of its controller at least one time. Then the IHostedService will start and work normally.

This behavior seems to be the Start Mode = OnDemand.

Did I miss something in the website configuration?

Thanks

Tratcher commented 5 years ago

This issue was moved to aspnet/IISIntegration#1465