Issue with ASP.NET 2.0 Global asax

A

Alexandre

For 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
 
H

Henrique Mello

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?
 
A

Alexandre

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 ..
 
A

Alexandre

P.S. the web application is not published it is only compiled on the
remote server.
 
H

Henrique Mello

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
 
A

Alexandre

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)
 
J

Jim Cheshire

Alexandre said:
For 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.

Are you using InProc Session state?

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.
 
A

Alexandre

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,
 
J

Jim Cheshire

Alexandre said:
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 ?

The fact that your'e using InProc Session state AND you say that Session
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.
 
A

Alexandre

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.
 
A

Alexandre

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
 
A

Alexandre

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
 
A

Alexandre

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,685
Members
48,796
Latest member
Greg L.

Latest Threads

Top