简体   繁体   English

Global.asax问题

[英]Global.asax issue

I am developing an HttpModule and using Global.asax. 我正在开发一个HttpModule并使用Global.asax。 I have developed a class which derives from HttpApplication, but Application_Start method of my class never executes (I create a file at the beginning of Application_Start but the file never creates, and it is why I think Application_Start never executes). 我开发了一个派生自HttpApplication的类,但是我的类的Application_Start方法永远不会执行(我在Application_Start的开头创建了一个文件但文件永远不会创建,这就是为什么我认为Application_Start永远不会执行)。 I am using VSTS2008 + C# + .Net 3.5. 我使用的是VSTS2008 + C#+ .Net 3.5。

Any ideas what is wrong and how to debug? 任何想法有什么问题以及如何调试? I want to confirm I should copy the Global.asax into the root directory of my web site virtual directory, correct? 我想确认我应该将Global.asax复制到我的网站虚拟目录的根目录中,对吗? Should I configure anything in web.config to let the HttpModule run? 我应该在web.config中配置任何东西让HttpModule运行吗?

Application_Start executes only once when an application starts first time. Application_Start仅在应用程序第一次启动时执行一次。 Do you have restarted your application? 你重新启动了你的申请吗?

Yes, Global.asax must be in the root directory. 是的,Global.asax必须位于根目录中。

You must add your new ASP.NET module into web.config <httpModules> section. 您必须将新的ASP.NET模块添加到web.config <httpModules>部分。

Did you add your module to the httpModules section in your web.config? 您是否已将模块添加到web.config中的httpModules部分? See: http://msdn.microsoft.com/en-us/library/ms227673.aspx 请参阅: http//msdn.microsoft.com/en-us/library/ms227673.aspx

你需要在web.config中添加一个条目http://msdn.microsoft.com/en-us/library/9b9dh535.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM