473,508 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Under what conditions would Application variables go away?

I have an application that has a webservice, and the web service is
utilizing Application variables to store login tokens for clients.
However, the application variable seems to be disappearing on occasion, and
I think it is because the application is somehow timing out and restarting.

Can anyone identify in what circumstances this might occur? Thanks!

-mdb
Apr 3 '07 #1
7 1324
IIS applications recycle due to a number of issues - memory pressure, IIS
Settings that make it recycle after a certain period of time, and unhandled
exceptions, among other reasons.

If you want to be able to preserve your Application variables across app
restarts, you should restore them in the Application_Start event handler in
Global.asax.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Michael Bray" wrote:
I have an application that has a webservice, and the web service is
utilizing Application variables to store login tokens for clients.
However, the application variable seems to be disappearing on occasion, and
I think it is because the application is somehow timing out and restarting.

Can anyone identify in what circumstances this might occur? Thanks!

-mdb
Apr 3 '07 #2
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
<pb*******@yahoo.yabbadabbadoo.comwrote in
news:42**********************************@microsof t.com:
If you want to be able to preserve your Application variables across
app restarts, you should restore them in the Application_Start event
handler in Global.asax.
But where would I store them that they would persist across Application
Restarts? I would have thought the Application[...] variable, but
wouldn't those variables go away when the app does restart??

-mdb
Apr 3 '07 #3
"Michael Bray" <mbray@makeDIntoDot_ctiusaDcomwrote in message
news:Xn****************************@207.46.248.16. ..
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
<pb*******@yahoo.yabbadabbadoo.comwrote in
news:42**********************************@microsof t.com:
>If you want to be able to preserve your Application variables across
app restarts, you should restore them in the Application_Start event
handler in Global.asax.

But where would I store them that they would persist across Application
Restarts? I would have thought the Application[...] variable, but
wouldn't those variables go away when the app does restart??

If these are tokens related to clients, then won't the client connections
and any associated data be destroyed by an app restart?

John
Apr 3 '07 #4
"John Saunders" <john.saunders at trizetto.comwrote in
news:Od**************@TK2MSFTNGP03.phx.gbl:
"Michael Bray" <mbray@makeDIntoDot_ctiusaDcomwrote in message
news:Xn****************************@207.46.248.16. ..
>=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
<pb*******@yahoo.yabbadabbadoo.comwrote in
news:42**********************************@microso ft.com:
>>If you want to be able to preserve your Application variables across
app restarts, you should restore them in the Application_Start event
handler in Global.asax.

But where would I store them that they would persist across
Application Restarts? I would have thought the Application[...]
variable, but wouldn't those variables go away when the app does
restart??


If these are tokens related to clients, then won't the client
connections and any associated data be destroyed by an app restart?

John
Yes that is the problem that we are experiencing... In other words, the
login token is being stored in a Hashtable that is stored in the
Application[...] variable. The clients are crashing when, it appears, the
Application_OnStart gets called and the hashtable is created anew, and
stored in the Application[...]. That's what the original question was
asking, to verify that this is what was (ie that it could) happen this way.
It seems that my suspicion was correct.

I guess the question is, how can I prevent the application from recycling,
or is there a better place to store user login token information? The
application is the highest-level object in terms of lifecycle that I know
of. The only other option would be to store in external system such as
SQL.

-mdb
Apr 3 '07 #5
"Michael Bray" <mbray@makeDIntoDot_ctiusaDcomwrote in message
news:Xn****************************@207.46.248.16. ..
"John Saunders" <john.saunders at trizetto.comwrote in
news:Od**************@TK2MSFTNGP03.phx.gbl:
>"Michael Bray" <mbray@makeDIntoDot_ctiusaDcomwrote in message
news:Xn****************************@207.46.248.16 ...
>>=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
<pb*******@yahoo.yabbadabbadoo.comwrote in
news:42**********************************@micros oft.com:
If you want to be able to preserve your Application variables across
app restarts, you should restore them in the Application_Start event
handler in Global.asax.

But where would I store them that they would persist across
Application Restarts? I would have thought the Application[...]
variable, but wouldn't those variables go away when the app does
restart??


If these are tokens related to clients, then won't the client
connections and any associated data be destroyed by an app restart?

John

Yes that is the problem that we are experiencing... In other words, the
login token is being stored in a Hashtable that is stored in the
Application[...] variable. The clients are crashing when, it appears, the
Application_OnStart gets called and the hashtable is created anew, and
stored in the Application[...]. That's what the original question was
asking, to verify that this is what was (ie that it could) happen this
way.
It seems that my suspicion was correct.

I guess the question is, how can I prevent the application from recycling,
or is there a better place to store user login token information? The
application is the highest-level object in terms of lifecycle that I know
of. The only other option would be to store in external system such as
SQL.
You can't entirely prevent an application from restarting, and in fact, you
couldn't depend on that in any case. What if your server system reboots?

Any solution to your problem must solve the "reboot" question. Storing these
tokens in a database would be one way to solve that. Another way would be
for your code to be more robust in the face of a missing token. If the token
is missing, the clients should log in again.

John
Apr 3 '07 #6
"John Saunders" <john.saunders at trizetto.comwrote in
news:uN**************@TK2MSFTNGP04.phx.gbl:
You can't entirely prevent an application from restarting, and in
fact, you couldn't depend on that in any case. What if your server
system reboots?

Any solution to your problem must solve the "reboot" question. Storing
these tokens in a database would be one way to solve that. Another way
would be for your code to be more robust in the face of a missing
token. If the token is missing, the clients should log in again.
Yes I would agree on the reboot - but I don't think it is unreasonable to
expect clients to have to restart when the server restarts - it would
certainly be nice if they didn't have to. I guess I was just looking for
confirmation that Application variables would go away if the application
restarts (and in particular why an application would restart) without the
server physically rebooting.

-mdb
Apr 4 '07 #7
If it is items like "Login tokens" that you are losing, I'd suggest you use
Forms Authentication. The Forms Cookie survives application restarts, and it
is not dependent on Session, Cache, ViewState, or Aplication State.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Michael Bray" wrote:
"John Saunders" <john.saunders at trizetto.comwrote in
news:uN**************@TK2MSFTNGP04.phx.gbl:
You can't entirely prevent an application from restarting, and in
fact, you couldn't depend on that in any case. What if your server
system reboots?

Any solution to your problem must solve the "reboot" question. Storing
these tokens in a database would be one way to solve that. Another way
would be for your code to be more robust in the face of a missing
token. If the token is missing, the clients should log in again.

Yes I would agree on the reboot - but I don't think it is unreasonable to
expect clients to have to restart when the server restarts - it would
certainly be nice if they didn't have to. I guess I was just looking for
confirmation that Application variables would go away if the application
restarts (and in particular why an application would restart) without the
server physically rebooting.

-mdb
Apr 4 '07 #8

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

Similar topics

2
5599
by: Paris_Sucks | last post by:
I'm trying to redirect when testing for certain condidtions as shown below. When the conditions are ture, it redirects, but still goes ahead and processes the sql query. What am I doing wrong??? ...
18
3487
by: Adrian B. | last post by:
Does anyone know of a framework or library that will enable me to use publish/subscribe comms? I want to create a server (using Python) running on a Unix box that will accept client connections...
4
1777
by: Me_Titus | last post by:
I would like to know if there is any kind of difference between an empty web project and an web application project other than all the files stucked toghether to the web application project. I am...
4
3524
by: BB | last post by:
Hello all, I might be missing something here, but am trying to understand the difference between using application-level variables--i.e. Application("MyVar")--and global variables--i.e. public...
20
4415
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
3
1440
by: Terry Holland | last post by:
Ive read that to build scalable web apps it is not recommended that state be stored in session variables. My understanding of this is that, with many users using the application concurrently,...
3
4137
by: rdemyan via AccessMonster.com | last post by:
Sometimes users (including myself) accidentally click on the application close icon in the application menu bar when they meant to just click on the 'X' for the form. Of course the app closes and...
9
4519
by: Doug Glancy | last post by:
I got the following code from Francesco Balena's site, for disposing of Com objects: Sub SetNothing(Of T)(ByRef obj As T) ' Dispose of the object if possible If obj IsNot Nothing AndAlso...
2
1415
by: new2c | last post by:
Hi - I'm completely new to C and trying to read some code that doesn't make sense to me. For proprietary reasons I can't display the code here but I'll describe it...and list part of it in a generic...
0
7132
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
7401
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...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
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
5640
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
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.