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)));
}
}
}