473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Life of a session.

Problem :

I have a Web Server which is session enabled. I have a method within that
server which if I call it repeatedly, it seems to forget the session every
six re-tries, and all the data therein. Is there, perhaps, a time-out
setting somewhere (one of the myriad) that I may have missed (although I
have run this sometimes, gone for a cup of tea, and return, done a re-run
and it has remembered the session data).

I have noted that when the browser is in the mood for remembering session
data, it response almost instantaneously to the re-try button, when it is in
the mood for forgetting session data, it takes up to half a minute to
respond.

Please help.
--- code fragment from the web service class constructor, intialising the
session values. ---

if (this.Session["SessionValue"] == null) {
this.Session["SessionValue"] = "InitialValue";
}
if (this.Session["RefCount"] == null) {
this.Session["RefCount"] = 0;
}
if (this.Session["Timing"] == null) {
this.Session["Timing"] = DateTime.Now.ToString();
}

--- the web method called repeatedly to increment the RefCount, and dump the
other values. ---

[WebMethod(true)]
public string Environment() {

string rv;
int i = 0;

try {
i = (int) this.Session["RefCount"];
i++;
this.Session["RefCount"] = i;

rv = "";
StringBuilder sb = new StringBuilder();
foreach (string indexer in this.Session) {
sb.AppendFormat("{0} = {1}\n", indexer,
this.Session[indexer].ToString());
}
sb.AppendFormat("Session ID = {0}", this.Session.SessionID);
rv = sb.ToString();

} catch (Exception e) {
throw new SoapException("Environment failed : " + e.ToString(),
SoapException.ClientFaultCode);
}
return rv;

}
Nov 21 '05 #1
4 3114
The session data will get flushed any time the ASP worker thread is
restarted. Check your IIS settings to see how often that is. I'm not sure
what the defaults are, but you can specify triggers based on elapsed
time, or a certain number of requests, or a certain amount of memory
usage.

Maybe your app is hitting one of those thresholds and causing ASP.NET to
recycle the worker thread.

Cheers,

Richard.
Nov 21 '05 #2
Thanks for the pointer, Richard.

Here's what I've done :

In web.config, I have added a <processModel> section and set all things that
can be set to "Infinite" to "Infinte", and doubled all the times that don't
allow "Infinite", with the exception of responseDeadlockInterval. I have
also increase memoryLimit to 95%.

In IIS (The specific Web site settings)
Virtual Directory->Application Settings Configuration->Options->Session
Timeout = 20 mins
Virtual Directory->Application Settings Configuration->Options->ASP Script
timeout = 90 secs

In IIS (Default Web Site settings)
Web site->Connection Timeout = 900 seconds

But still the session persistence is hit-and-miss (when running in the
debugger, it's definitely more miss than hit), so after a random number of
method calls from the client, the session is restarted, and all previous
session values are lost.

Is there any other session setting that might help?
"Richard Thombs" <ri************@compositedata.com> wrote in message
news:pa****************************@compositedata. com...
The session data will get flushed any time the ASP worker thread is
restarted. Check your IIS settings to see how often that is. I'm not sure
what the defaults are, but you can specify triggers based on elapsed
time, or a certain number of requests, or a certain amount of memory
usage.

Maybe your app is hitting one of those thresholds and causing ASP.NET to
recycle the worker thread.

Cheers,

Richard.

Nov 21 '05 #3
Eric,

Sounds like you are running on IIS 5? I'm sorry, I think most of the
settings I was describing were for IIS 6. It seems to me that you have
changed everything that could be causing the session to expire.

Does the Session ID you are checking in your code change when the session
is wiped out?

Is there anything special about the the device is connecting to the
server? I'm not sure if session cookies are based on the machine's source
IP address - just thinking that perhaps the Pocket PC's IP address is
sometimes changing and that is causing the web server to think it's
another client and therefore starts a new session.

Richard.

On Thu, 08 Jul 2004 15:52:29 +0100, Eric Porter wrote:
Thanks for the pointer, Richard.

Here's what I've done :

In web.config, I have added a <processModel> section and set all things that
can be set to "Infinite" to "Infinte", and doubled all the times that don't
allow "Infinite", with the exception of responseDeadlockInterval. I have
also increase memoryLimit to 95%.

In IIS (The specific Web site settings)
Virtual Directory->Application Settings Configuration->Options->Session
Timeout = 20 mins
Virtual Directory->Application Settings Configuration->Options->ASP Script
timeout = 90 secs

In IIS (Default Web Site settings)
Web site->Connection Timeout = 900 seconds

But still the session persistence is hit-and-miss (when running in the
debugger, it's definitely more miss than hit), so after a random number of
method calls from the client, the session is restarted, and all previous
session values are lost.


Nov 21 '05 #4
I am indeed running IIS V5.1.

The intersting thing about all this is that the SessionID remains the same,
only the Session[...] values disappear.

The only out-of-the-ordinary thing I can think of in my scenario is that the
Web Service I'm writing resides on a trusted network drive, with an IIS
virtual directory pointing at it (a technique I favour, because my C-drive
is not backed-up, but the network drive is). Could this be having an
adverse affect?

The next thing I was going to try, in an attempt to increase reliability of
my sessions, was to move the Web Service to my local machine.

Eric
"Richard Thombs" <ri************@compositedata.com> wrote in message
news:pa****************************@compositedata. com...
Eric,

Sounds like you are running on IIS 5? I'm sorry, I think most of the
settings I was describing were for IIS 6. It seems to me that you have
changed everything that could be causing the session to expire.

Does the Session ID you are checking in your code change when the session
is wiped out?

Is there anything special about the the device is connecting to the
server? I'm not sure if session cookies are based on the machine's source
IP address - just thinking that perhaps the Pocket PC's IP address is
sometimes changing and that is causing the web server to think it's
another client and therefore starts a new session.

Richard.

On Thu, 08 Jul 2004 15:52:29 +0100, Eric Porter wrote:
Thanks for the pointer, Richard.

Here's what I've done :

In web.config, I have added a <processModel> section and set all things that can be set to "Infinite" to "Infinte", and doubled all the times that don't allow "Infinite", with the exception of responseDeadlockInterval. I have also increase memoryLimit to 95%.

In IIS (The specific Web site settings)
Virtual Directory->Application Settings Configuration->Options->Session
Timeout = 20 mins
Virtual Directory->Application Settings Configuration->Options->ASP Script timeout = 90 secs

In IIS (Default Web Site settings)
Web site->Connection Timeout = 900 seconds

But still the session persistence is hit-and-miss (when running in the
debugger, it's definitely more miss than hit), so after a random number of method calls from the client, the session is restarted, and all previous
session values are lost.

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: cognite | last post by:
This venue would surely appreciate the cool stuff being done in python on bioinformatics and python's tools for info parsing and extraction (like fulltext indexing, xml tools, parser builders,...
14
by: qaz | last post by:
I've always used session cookies in my web sites. However, since more and more people (including me) are starting to disable cookies, I'm beginning to think that I should change my ways and design...
0
by: Piotr Strycharz | last post by:
The life with ViewState is difficult - say 70kB of mess.... The life without View State is very difficult: 1. No access to Field.Value or Field.Text at Page_Load (are empty) 2. No access to...
3
by: Michael Johnson Jr. | last post by:
The problem is the following pseudo code causes you need to click buttons twice to get event. This is notable via debugging and single stepping. I can't seem to quite figure out how to do...
2
by: Chan | last post by:
In MS' TimeTracker sample app, a middle-tier component BLL has a class named TimeEntry. It's used in TimeEntry.aspx to remember a certain state of an entry. I must have missed something but just...
6
by: jim | last post by:
Hi All, I like to know the life cycle of an ASP .NET Application( incudieng server application, such as .NET Web Service). That means from initialization to fully running and how to reboot it or...
10
by: njk966 | last post by:
I have a dynamically loaded control that queries a database and fills the results into a new object. Class Person ...class properties ...class methods End Class Dim Person As New Person...
1
by: damod.php | last post by:
what is the life time(min, Max) of session variables,, I want to know about sessions whats session what is cookie whts the diff between where the sessinon stored where the cookie stored i want...
8
by: Jason | last post by:
What's the correct term when talking about the life of a variable in vb.net web? in a vb.net codebehind for asp.net, is it possible to define a variable in one sub, and call another sub and...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.