多的Application_Start事件触发 [英] Multiple Application_Start events firing
问题描述
我调试ASP.NET 2.0应用程序是从初始页面的加载速度慢的痛苦。
通过添加日志中,我发现,这两个事件之间有短暂的延迟的Application_Start
事件触发启动时的两倍。在在session_start
事件还激发了两次,用相同的会话ID值。
例如
[标题]
2010-09-10 14:52:36.331 INFO Web.Global.Application_Start START
2010-09-10 14:52:37.409 INFO Web.Global.Session_Start Session.SessionID = xxqjvun2ce2yqsumq1hfoj45
[标题]
2010-09-10 14:53:10.028 INFO Web.Global.Application_Start START
2010-09-10 14:53:10.325 INFO Web.Global.Session_Start Session.SessionID = xxqjvun2ce2yqsumq1hfoj45
我在我的本地机器上运行此,IIS 5.1之下。该项目还使用了ASP.NET MVC和使用使用路由改变aspx页面URL,的使用上菲尔哈克的网站所示的技术。
什么可能导致这有什么建议?
我们最终意识到,这是到我们的IIS配置。
前段时间决定将重命名使用本网站的虚拟目录。这是通过将整个新的虚拟目录结构中,在离开previous酮代替完成。从本质上讲,我们有两个虚拟目录在相同的ASP.NET应用程序指点!
到新的虚拟目录迁移从未完成,所以网站的部分仍然被引用旧的。因此,两个的Application_Start
事件...
此修复程序是更改设置IIS中的旧的虚拟目录是的重定向到URL 的设置为 / NewVirtualDirectory $ S $ Q 的<网址/ p>
I am debugging an ASP.NET 2.0 application that is suffering from slow loading of the initial page.
Through adding logging, I've found that the Application_Start
event fires twice on startup with a short delay between the two events. The Session_Start
event also fires twice, with the same Session ID value.
e.g.
[Header] 2010-09-10 14:52:36.331 INFO Web.Global.Application_Start START 2010-09-10 14:52:37.409 INFO Web.Global.Session_Start Session.SessionID=xxqjvun2ce2yqsumq1hfoj45 [Header] 2010-09-10 14:53:10.028 INFO Web.Global.Application_Start START 2010-09-10 14:53:10.325 INFO Web.Global.Session_Start Session.SessionID=xxqjvun2ce2yqsumq1hfoj45
I am running this on my local machine, under IIS 5.1. The project also uses ASP.NET MVC and the aspx page URL being used is altered using routing, using the technique shown on Phil Haack's site.
Any suggestions about what could cause this?
We eventually realised that this was down to our IIS configuration.
Some time ago a decision was made to rename the virtual directory used for this website. This was done by adding a whole new virtual directory configuration, leaving the previous one in place. Essentially we had two virtual directories pointing at the same ASP.NET app!
The migration to the new virtual directory was never completed, so parts of the website still referenced the old one. Hence two Application_Start
events...
The fix was to change to setup to the old virtual directory in IIS to be A redirection to a URL with the URL set to /NewVirtualDirectory$S$Q
这篇关于多的Application_Start事件触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!