session variables being lost

P

Paul

Hi I have a web application vs2005 and it looks like a condition is causing
session veriables to be lost. This does not seem to be happening too often.
The web application allows uploading and deleting files on the server, but
not in the bin directory. I am not sure if this is related. Any idea what
might be causing this and how to fix it?
Thanks.
 
M

Mark Fitzpatrick

Does it happen after a certain amount of time? Have you checked to make sure
the application is not being recycled due to either 20 minutes of activity
or perhaps the memory usage getting too high? What sort of things are you
holding in session? You aren't storing large datasets or files in session
are you? It could be that you're exceeding memory useage and the web server
restarts the application in order to perform garbage collection and free up
resources.

Hope this helps,
Mark Fitzpatrick
 
P

Paul

Thanks for the response, I do not think it is a session variable timing out
but the memory issue might be worth investigating. There are several objects
that get saved to session variables, will need to look at each one to see
what is included as there were a few different authors that built the web
application. I do not think we are saving any files to session state but
will need to confirm this. Is there any easy way to tell if the memory is
being exceeded, windows event log?

--




Mark Fitzpatrick said:
Does it happen after a certain amount of time? Have you checked to make sure
the application is not being recycled due to either 20 minutes of activity
or perhaps the memory usage getting too high? What sort of things are you
holding in session? You aren't storing large datasets or files in session
are you? It could be that you're exceeding memory useage and the web server
restarts the application in order to perform garbage collection and free up
resources.

Hope this helps,
Mark Fitzpatrick
 
S

sloan

I have not tried this, but think it would be interesting:

http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx

ScottGu is daBomb of course on this stuff.

If you find a way to track the event, please post a followup here.



Paul said:
Thanks for the response, I do not think it is a session variable timing
out
but the memory issue might be worth investigating. There are several
objects
that get saved to session variables, will need to look at each one to see
what is included as there were a few different authors that built the web
application. I do not think we are saving any files to session state but
will need to confirm this. Is there any easy way to tell if the memory is
being exceeded, windows event log?
 
P

Paul

Hi, not sure if the application is actually restarting although the session
variables are being reset. The health monitor looks like it might be
interesting to impliment!
 
B

bruce barker

if you upload to any folder other than appdata, then a recycle can be
triggered.


-- bruce (sqlwork.com)
 
P

Paul

thanks for the information, wondering if this is something new in vs2005 and
if there is a way to shut it off, were you can upload to any other folder
(other than the bin) without loosing the current session variables?
 
J

Juan T. Llibre

An application domain will unload (causing loss of session variables
unless session state is maintained with State Server or SQL Server),
when any one of the following occurs:

a. Machine.Config, Web.Config or Global.asax are modified
b. The bin directory or any of its contents is/are modified
c. The App_Code directory contents changes
d. The number of re-compilations (aspx, ascx or asax) exceeds the limit specified by the
<compilation numRecompilesBeforeAppRestart=/> setting in machine.config or web.config
(by default this is set to 15)
e. The physical path of the virtual directory is modified
f. The CAS policy is modified
g. A web service is restarted
h. (2.0 only) Application Sub-Directories are deleted
i. Any of a number of configurable App Pool recycling reasons occurs


This should cover most scenarios.
 
P

Paul

thanks for the additional information, still not sure what is causing it but
I wrote a small sample program and I am able to upload files to the root
directory ok, but when I upload to the bin directory it looses the session
variable, which corresponds to listing c provided. I am not sure what the
CAS policy is, also not quite sure what listing i means?
 
J

Juan T. Llibre

Hi, Paul.

re:
!> I am not sure what the CAS policy is

CAS is the Code Access Security configuration

General info:
http://msdn.microsoft.com/en-us/library/930b76w0.aspx

If you create any custom Code Access Security permissions, per the instructions at:
http://msdn.microsoft.com/en-us/library/yctbsyf4.aspx

....as soon as the custom permissions are implemented, the AppDomain will unload/restart,
causing the loss of session variables, unless you don't use in-process state management,
i.e., unless you use SQL Server or State Server to manage state in your application.

re:
!> also not quite sure what listing i means?

Whenever you change any configurable reason for an Application Pool to recycle,
that will cause an automatic Application Pool recycle, with the same events
described above occurring.

You can configure Application Pools with the IIS Manager.

Open the IIS Manager, scroll down on the left panel to "Application Pools",
right click the desired Application Pool, select "Properties" and configure to your needs.

Be careful and know what you are doing before changing that stuff, though.
You can seriously harm your Application and server's performance if you misconfigure an App Pool.

More info on Application Pool specific configuration parameters:

http://www.microsoft.com/technet/pr...IIS/1652e79e-21f9-4e89-bc4b-c13f894a0cfe.mspx

An extremely good tutorial on Ensuring Application Availability :
http://www.microsoft.com/technet/pr...IIS/1652e79e-21f9-4e89-bc4b-c13f894a0cfe.mspx

On this last page, open the fly-ou menu on the left,
and make sure you read through every single page.

It will be one of the best investments you can make in regard to learning
how to configure your applications for top availability and performance.





Paul said:
thanks for the additional information, still not sure what is causing it but
I wrote a small sample program and I am able to upload files to the root
directory ok, but when I upload to the bin directory it looses the session
variable, which corresponds to listing c provided. I am not sure what the
CAS policy is, also not quite sure what listing i means?
 

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

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top