Click here to Skip to main content
15,913,587 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have search everywhere but nothing applies to my problem.

I am TRYING to initialize some objects in Application_Start(). Application_Start() is never called on my server but is on my desktop.

I think the problem lies in the fact that when I load the site to the server, using Web Deploy, the Global.asax and Global.asax.cs end up in BOTH the root and bin directories when they should only be in my root with web.config.

Adding child filePath (Default Web Site\bin\Global.asax).
Adding child filePath (Default Web Site\bin\Global.asax.cs).
...
Adding child filePath (Default Web Site\Global.asax).


Can anyone give me an explanation as to why this is happening? The asax files should reside in the root directory correct? Is this the reason why Application_Start() is not being called?

Also...If I look in the bin folder in my project, it does NOT contain the asax files.

One other thing I just noticed...after I load the site to the server, the local bin folder in my project seems to have both files.

Thanks.
Posted
Updated 14-Nov-10 12:29pm
v2

1 solution

If you change the web.config file and save changes it will force the application to be re-started.
After that check if the Application_Start() event is fired
 
Share this answer
 
Comments
willworknow1 15-Nov-10 7:47am    
This worked. Thanks. Now why wouldn't the application restart every time I load it using Web Deploy? Also, it doesn't restart when I cycle the server or IIS.
Ed Guzman 15-Nov-10 8:42am    
While deploying it you do not stop the Application object on the server site.
The application object is destroyed only when you stop WWW service, stop IIS, stop your website through IIS, application crashes, or you just change your web.config, telling your application to collect the changes.
There are some more events, i just don't remember on the top on my mind.
Libino Giffrin 6-Jul-18 3:14am    
Super

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900