Multiple Application_Start events firing
Asked Answered
A

4

15

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?

Ampere answered 10/9, 2010 at 13:59 Comment(3)
Is the application by any chance modifying the web.config file?Sura
Do you have Application_End fired in between? Do you have any calls to "HttpRuntime.UnloadAppDomain" in your code?Issuance
In my case it was Mc Afee Virus scan. I followed this guide to exclude folders support.microsoft.com/en-us/kb/3126034Phanerogam
A
14

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

Ampere answered 12/4, 2011 at 8:11 Comment(0)
T
5

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!

Turbinate answered 5/5, 2020 at 21:21 Comment(0)
L
3

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!

Logarithm answered 9/7, 2012 at 17:51 Comment(0)
N
1

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.

Nkvd answered 19/12, 2016 at 22:5 Comment(1)
After more years, I faced with same problem and searching in google and found this solution again and It's mine ;-) I hope this helps too :-)Nkvd

© 2022 - 2024 — McMap. All rights reserved.