触发多个 Application_Start 事件

发布于 2024-09-18 05:36:13 字数 821 浏览 10 评论 0 原文

我正在调试一个 ASP.NET 2.0 应用程序,该应用程序的初始页面加载缓慢。

通过添加日志记录,我发现 Application_Start 事件在启动时触发两次,两次事件之间有短暂的延迟。 Session_Start 事件也会触发两次,并具有相同的会话 ID 值。

例如

[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

,我在本地计算机上的 IIS 5.1 下运行它。该项目还使用 ASP.NET MVC,并且使用的 aspx 页面 URL 通过路由进行更改,使用 Phil Haack 网站上显示的技术

关于可能导致这种情况的任何建议?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

如果没结果 2024-09-25 05:36:13

我们最终意识到这取决于我们的 IIS 配置。

不久前,我们决定重命名该网站使用的虚拟目录。这是通过添加全新的虚拟目录配置并保留前一个虚拟目录配置来完成的。本质上,我们有两个虚拟目录指向同一个 ASP.NET 应用程序!

向新虚拟目录的迁移从未完成,因此网站的部分内容仍然引用旧虚拟目录。因此有两个 Application_Start 事件...

修复方法是将 IIS 中的旧虚拟目录设置为 重定向到 URL,并将 URL 设置为 /NewVirtualDirectory$S$Q

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

手长情犹 2024-09-25 05:36:13

经过4天的努力,我终于找到问题所在了!
如果您更改 Bin 目录中的任何文件,IIS 会重置您的应用程序和应用程序池。
对我来说,这是因为我的程序曾经在 Bin 目录中写入 log.txt 文件。
我更改了日志文件路径,问题就消失了!

After spending 4 days, I have finally found the problem out!
If you change any file in Bin directory, IIS resets your application and Application pool.
For me, it was because of log.txt file that my program used to write in Bin directory.
I changed the log file path and the problem has been vanished!

我喜欢麦丽素 2024-09-25 05:36:13

我们遇到了类似的情况,只是发现这是因为我们进行了程序集重命名,并且有引用该程序集存在的相同代码的两个副本,即 versionA.dll 和 versionB.dll。因此它被调用了两次!

We had a similar situation happen only to discover that it was because we had done an assembly rename and had two copies of the same code referencing that assembly existed, versionA.dll and versionB.dll. So it was being called twice because of that!

年华零落成诗 2024-09-25 05:36:13

根据我的经验(经过数小时的研究和大量的编码)

x64 文件夹中未删除的 SQLite.Interop.dll

我通过文件管理从托管面板而不是 FTP (FileZilla) 中删除,并且多个 Application_Start 事件触发消失了:-) 问题的根本原因是不可阻挡的 Quartz.Net 进程已连接到此 dll。

In my experienced (after hours research and tons of coding) that comes from

undeleted SQLite.Interop.dll in x64 folder

I deleted by File Management from hosting panel instead of FTP (FileZilla) and Multiple Application_Start events firing gone :-) Root causes of problems was unstoppable Quartz.Net process that was connected to this dll.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文