2
我如何才能登錄.NET Web服務重新啓動或Web服務代碼登錄web服務的啓動/停止
我如何才能登錄.NET Web服務重新啓動或Web服務代碼登錄web服務的啓動/停止
內停止假設你正在談論整個Web服務應用程序,檢查Global.asax文件。您可以在Application_Start和Application_End事件中添加日誌記錄代碼。
public class Global : System.Web.HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
// Add logging here
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
// Add logging here
}
}
使用onStart
和OnStop
事件。示例代碼here。
您可能想描述爲什麼要這樣做,因爲Web服務(ASP.NET Web服務)的方式的性質使得啓動和停止可能不是您真正想要或使用的。 – 2011-03-11 06:15:12