[英]How to write Code that runs Periodically at certain intervals in .Net 5.0 C# or F#
I've written some Code in F# ( some in C# ) /.Net 5.0 and I am just running it as a console app currently and debugging it in visual studio.我已经在 F# (一些在 C# )/.Net 5.0 中编写了一些代码,我目前只是将它作为控制台应用程序运行并在 Visual Studio 中调试它。
I want it to我想要它
What approach should I take with this?我应该采取什么方法呢? When I was writing nodejs apps I used to put the command line command in to the windows scheduler.
当我编写 nodejs 应用程序时,我曾经将命令行命令放入 windows 调度程序中。
Should I我是不是该
I'm not sure what approach to take & I might be missing an approach that fits this task perfectly.我不确定要采取什么方法,我可能会错过一种完全适合这项任务的方法。
If you are using Windows to run the exe you can use the built in Task Scheduler.如果您使用 Windows 运行 exe,您可以使用内置的任务计划程序。 Regarding pausing the application, you can add a watcher to the app which will check for status before it runs.
关于暂停应用程序,您可以向应用程序添加一个观察者,该观察者将在应用程序运行之前检查状态。 Eg looks at a database or a centralised config file.
例如查看数据库或集中配置文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.