|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Issue with ASP.NET 2.0 Global asaxFor some odd reason I have notices that every time I refreshed a page
in my browser ( same session ) ASP.NET called : void Application_Start(object sender, EventArgs e) I am absolutly confused since nothing in my code resets the application. the session variables seem to be untoutched. does any one else have this kind of problem? maybe im missing some information here. Can anyone throw out some ideas ? Best Regards, Alexandre Brisebois This in the Global.asax?
Strange, this event is trigger every time you recompile , or reestart the server. Do you have any special setting on your IIS or in the machine.config? I dont think I have any special settings, I had my hosting install
asp.net 2.0 a few weeks ago and have runinto a few problems, I do not know if they installed everything properly or so, I also was faced with file permission problems, but no this is happenning even if I set session to timeout at 20 mins and even when I dont compile.. though I must mention this is not the root application in the tree, but it is the only application in its application pool. im absolutly out of ideas .. P.S. the web application is not published it is only compiled on the
remote server. Yes the application compiled or released ... dunno if this have
anything to do with it but Debug sometimes break things, that in release works fine Even after publish the problem occurs over and over again,
here is my code: void Application_Start(object sender, EventArgs e) { Live.Config.Instance.DirectoryAbsoluteLocation = Server.MapPath("App_Data/"); Live.Config.Instance.LocationConfig = Live.Config.Location.Server; System.IO.FileInfo MenuXML = new System.IO.FileInfo(Config.Instance.DirectoryAbsoluteLocation + @"\Menu.xml"); if (MenuXML.Exists) { if (Application["BaseMenu"] != null && Application["MenuLastWriteDate"] != null) { if (Application["MenuLastWriteDate"].ToString().CompareTo(MenuXML.LastWriteTimeUtc.ToString()) != 0) { loadMenuFromXml(MenuXML); } } else { loadMenuFromXml(MenuXML); } } } private void loadMenuFromXml(System.IO.FileInfo MenuXML) { Live.Components.Menu Switcher = new Live.Components.Menu(); Live.XML.LoadState ls = new Live.XML.LoadState(); ls.Load(Switcher); Application["MenuLastWriteDate"] = MenuXML.LastWriteTimeUtc.ToString(); Application["BaseMenu"] = Switcher; } in the code above, I should only load up a Menu from the XML file when the File last write datetime changes. and it should only be called on app start. what I am getting is that the menu gets loaded everytime the time changes even if I have not changed sessions (simple refresh) Alexandre wrote:
> For some odd reason I have notices that every time I refreshed a page Are you using InProc Session state?> in my browser ( same session ) ASP.NET called : void > Application_Start(object sender, EventArgs e) > > I am absolutly confused since nothing in my code resets the > application. > the session variables seem to be untoutched. > Monitor the ASP.NET v2.0.50727 object's Application Restarts counter and see if it increments as well. If it does, you can use health monitoring to log app restarts and the reason for them. If you don't know how to do that, let me know and I can post some sample code. -- Jim Cheshire ================================ Blog: http://blogs.msdn.com/jamesche Latest entry: Getting the PID and TID of a COM Call Describes how to get the PID of the dllhost process a COM call is executing in and how to locate the thread as well. I am using InProc state
I have not used the health monitoring yet but I guess nows the best time to learn. could you showme some sample code ? regards, Alexandre wrote:
> I am using InProc state The fact that your'e using InProc Session state AND you say that Session > > I have not used the health monitoring yet but I guess nows the best > time to learn. > could you showme some sample code ? > state is being maintained tells me that the app domain isn't recycling. However, I'd still be curious to know if the perfmon counter I mentioned increments. Does it? -- Jim Cheshire ================================ Blog: http://blogs.msdn.com/jamesche Latest entry: Getting the PID and TID of a COM Call Describes how to get the PID of the dllhost process a COM call is executing in and how to locate the thread as well. i used a simple Application[] and incrementing an int inside of it
curiously its not incrementing but the menu refreshes :S:S then i check if the loading method was being called it is not ... the increment sates as is = to 1 either the App variables are being reset or something is really weird. I have been checking everywhere if by any chance I was reloading the
menu, and no other menthods refresh the menu. Application[] seem not to change and Session is kept as is :S Summary of symptoms:
using (Session[]) Session is kept using (Application[]) Increments in loadMenuFromXml(System.IO.FileInfo MenuXML) <- some how executed without incrementating :S AND in Application_Start(object sender, EventArgs e) do not increment using (Application[]) increment in web user control increments I found the problem, this might be interesting for any one working
through hVisual Studio 2005. When you modify a file through VS2k5 in my case its an xml file place in the App_Date directory. The simple fact of saving the file restarts the application. when modifying the file through a normal externam ftp the app is not affected. thank you all for your time and patience, I greatly apreciated all your inputs. Regards,
Other interesting topics
Help: ASP.Net broken (tried usual suspects...)
ASP.NET 2.0 menu: where to set alternate text for "^ up one level Can't open asp xml page Question about string Error: 'CreateUser' is not a member of 'Membership' vs2005: domain trust relationship problem What is the database "standard" in 2.0? Question on string XMLHTTP question DataGrid Columns Spannig More Than One Column |
|||||||||||||||||||||||