2013-04-05 58 views
1

我用iis發佈我的asp.net站點(我的本地機器有iis v8,服務器的iis v7)。 但我想立即在Global.asax.cs中啓動一個函數,而無需調用頁面。在沒有請求的Global.asax中調用ApplicationStart方法

*當我調用一個頁面時,啓動global.asax.cs的Application_Start方法。我要啓動它,而不需要頁面呼叫請求*

 

namespace ProductService.XmlFeed 
{ 
    public class Global : HttpApplication 
    { 
     protected void Application_BeginRequest(Object sender, EventArgs e) 
     { 
      FtpUploaderMain.RegisterCacheEntry(); //this method I want to start without page call 
     } 

     void Application_Start(object sender, EventArgs e) 
     { 
      SimpleLogger.WriteLog("Application Started without a page call","D:\\log.txt"); 

      RegisterRoutes(); 

      //FtpUploaderMain.RegisterCacheEntry(); 
     } 

     private void RegisterRoutes() 
     { 
      RouteTable.Routes.Add(new ServiceRoute("Products", new WebServiceHostFactory(), typeof(ProductXmlFeedService))); 
     } 
    } 
} 
 

回答

相關問題