Will IIS recycle the asp.net core process?

跟風遠走 提交于 2019-12-10 03:09:23

问题


I need to run long running background tasks in my asp.net core application. I know of Azure Webjobs and other out of process techniques but I'd rather keep the solution simple and runs those tasks directly in the asp.net core process. I use Kestrel and the application is hosted in IIS.

I understand that IIS will occasionally recycle the IIS process. Will it also recycle the asp.net core process?


回答1:


Asp.Net Core < 2.2

Asp.net Core runs in a separate process dotnet.exe even when it is hosted in IIS. But it doesn't mean that it runs as an independent process. IIS still responsible for Asp.net core process (dotnet.exe) life cycle through the AspNetCoreModule.

So, answer is yes, IIS will also recycle the asp.net core process

Asp.Net Core >= 2.2

Asp.Net Core 2.2 has in-process hosting support on IIS in addition to out-of-process hosting model that was before. It seems it is just an optimization that allows to avoid the additional cost of reverse-proxying requests over to a separate dotnet process. IIS will recycle application pool with Asp.net Core application




回答2:


I have do a experiment use ' IApplicationLifetime applicationLifetime ' like aspnet Golbal.aspx

When the iis application recycle , the registerd 'ApplicationStopping' be triggered.

SO i will belive the https://github.com/aspnet/KestrelHttpServer/issues/1040#issuecomment-267506588




回答3:


Nope, It would not. IIS application pool only takes care of w3wp.exe process.

ASP.NET Core is hosted by Kestrel process, and IIS is just a reverse proxy in front of it.



来源:https://stackoverflow.com/questions/41176745/will-iis-recycle-the-asp-net-core-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!