简体   繁体   English

C# 和 ASP.NET 定时器 function 每周仅运行一次 sql

[英]C# and ASP.NET timer function that runs sql only once a week

I have just started learning asp.net and C#. I need to create a function that runs once a week, every Monday and returns a new entry in my SQL database.我刚刚开始学习 asp.net 和 C#。我需要创建一个每周运行一次的 function,每周一并在我的 SQL 数据库中返回一个新条目。

Does anyone have any suggestions for how I should approach this?有人对我应该如何处理这个问题有什么建议吗? And are you aware of any ways to have this kind of functionality without a data log table that checks if the function has already been run for that week?如果没有数据日志表来检查 function 是否已经在该周运行,您是否知道有任何方法可以实现这种功能?

Try Hangfire - it can schedule a job and repeat it.试试 Hangfire——它可以安排一个工作并重复它。

There are some solutions to do this.有一些解决方案可以做到这一点。 Check this out: [https://www.hanselman.com/blog/how-to-run-background-tasks-in-as.net][1]检查一下:[https://www.hanselman.com/blog/how-to-run-background-tasks-in-as.net][1]

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

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