我System.Timers.Timer在我的 Asp.Net 应用程序中使用了 a ,我需要使用HttpServerUtility.MapPath似乎只能通过HttpContext.Current.Server.MapPath. 问题在于HttpContext.Current事件null何时Timer.Elapsed触发。
还有另一种方法来获取对 HttpServerUtility 对象的引用吗?我可以将它注入我的类的构造函数中。安全吗?我怎么能确定它不会在当前请求结束时被垃圾收集?
谢谢!