Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 IIS 中启动应用程序时启动一个计时器。
你认为最好的地方是 Global.asax 的 Application_Start 吗?
非常感谢你。
这是一个好地方,因为通过这种方式,您可以绝对捕获应用程序池启动的那一刻,但这并不意味着它必须存在于那里而不是在 Singleton 类中,例如,它从Application_Start.
Application_Start
这实际上取决于您以后需要在哪里使用该计时器。