简体   繁体   English

IIS是否会回收asp.net核心进程?

[英]Will IIS recycle the asp.net core process?

I need to run long running background tasks in my asp.net core application. 我需要在asp.net核心应用程序中运行长时间运行的后台任务。 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. 我知道Azure Webjobs和其他进程外技术,但我希望使解决方案保持简单,并直接在asp.net核心进程中运行这些任务。 I use Kestrel and the application is hosted in IIS. 我使用Kestrel,该应用程序托管在IIS中。

I understand that IIS will occasionally recycle the IIS process. 我了解IIS有时会回收IIS进程。 Will it also recycle the asp.net core process? 还会回收asp.net核心进程吗?

Asp.Net Core < 2.2 Asp.Net Core <2.2

Asp.net Core runs in a separate process dotnet.exe even when it is hosted in IIS . 即使将Asp.net Core托管在IIS ,它也会在单独的进程dotnet.exe运行。 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 . IIS仍通过AspNetCoreModule负责Asp.net core进程( dotnet.exe )的生命周期。

So, answer is yes, IIS will also recycle the asp.net core process 因此,答案是肯定的,IIS还将回收asp.net核心进程

Asp.Net Core >= 2.2 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. 除了以前out-of-process托管模型外,Asp.Net Core 2.2还对IIS提供了in-process托管支持。 It seems it is just an optimization that allows to avoid the additional cost of reverse-proxying requests over to a separate dotnet process. 看来,这只是一项优化,可以避免将反向代理请求添加到单独的dotnet进程的额外费用。 IIS will recycle application pool with Asp.net Core application IIS将使用Asp.net Core应用程序回收应用程序池

I have do a experiment use ' IApplicationLifetime applicationLifetime ' like aspnet Golbal.aspx 我做了一个实验,使用“ IApplicationLifetime applicationLifetime”,如aspnet Golbal.aspx

When the iis application recycle , the registerd 'ApplicationStopping' be triggered. 当iis应用程序回收时,将触发注册的“ ApplicationStopping”。

SO i will belive the https://github.com/aspnet/KestrelHttpServer/issues/1040#issuecomment-267506588 所以我会相信https://github.com/aspnet/KestrelHttpServer/issues/1040#issuecomment-267506588

Nope, It would not. 不,不会。 IIS application pool only takes care of w3wp.exe process. IIS应用程序池仅负责w3wp.exe进程。

ASP.NET Core is hosted by Kestrel process, and IIS is just a reverse proxy in front of it. ASP.NET Core由Kestrel进程托管,而IIS只是它前面的反向代理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM