简体   繁体   English

如何在自托管的.net核心mvc应用程序中运行长时间运行或重复运行的任务?

[英]How should I run long-running or recurring taks in a self-hosted .net core mvc application?

What is the best practice for running additional continuous tasks(eg a timer) in .net core mvc application (since there is no Application_start event). 在.net核心mvc应用程序中运行其他连续任务(例如计时器)的最佳实践是什么(因为没有Application_start事件)。 Should i place it in the Main method or somewhere else? 我应该将其放置在Main方法中还是其他地方?

It's a self-hosted app. 这是一个自托管的应用程序。

I would create it a separate Console App and schedule a window task using Task Scheduler to execute this app as needed, this is the case if you are deploying in a VM, if you are deploying to Azure, then it will be a Web Job. 我将创建一个单独的控制台应用程序,并使用任务计划程序计划一个窗口任务以根据需要执行该应用程序,如果要在VM中进行部署,如果要部署到Azure,则将是Web Job。

I will do my best to keep away any long running processes from MVC 我将尽我所能避免任何长期运行的MVC进程

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

相关问题 自托管 Net Core 3 应用程序不采取端口设置 - Self-hosted Net Core 3 application does not take port settings 自托管 .NET 核心控制台应用程序中的 Startup.cs - Startup.cs in a self-hosted .NET Core Console Application 如何将外部域绑定到 .NET Core 3.1 Kestrel 自托管应用程序? - How to bind external domain to .NET Core 3.1 Kestrel self-hosted application? ApiController中的长时间运行任务(使用WebAPI,自托管OWIN) - Long running task in ApiController (using WebAPI, self-hosted OWIN) 自托管进程中 Web API 带点网核心 - Self-hosted In Process Web API with Dot net core 在多个Web应用程序工作进程中运行自托管的WCF - Running WCF self-hosted in multiple web application worker processes 如何在Windows上运行的自托管ServiceStack中获取用户名 - How do I get the username in a self-hosted ServiceStack running on Windows 在自托管 OWIN Web API 中,如何在关机时运行代码? - In self-hosted OWIN Web API, how to run code at shutdown? 如何安全退出自托管应用程序(退出前先做点事情) - How can I safe to quit self-hosted application (do something before quit) 如何在自托管的WebAPI应用程序中正确缓存数据 - how to properly cache data in a self-hosted WebAPI application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM