473,669 Members | 2,385 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 1339
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_Sta rt 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?UGV0ZXIgQnJ vbWJlcmcgW0MjIE 1WUF0=?=
<pb*******@yaho o.yabbadabbadoo .comwrote in
news:42******** *************** ***********@mic rosoft.com:
If you want to be able to preserve your Application variables across
app restarts, you should restore them in the Application_Sta rt 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@makeDInt oDot_ctiusaDcom wrote in message
news:Xn******** *************** *****@207.46.24 8.16...
=?Utf-8?B?UGV0ZXIgQnJ vbWJlcmcgW0MjIE 1WUF0=?=
<pb*******@yaho o.yabbadabbadoo .comwrote in
news:42******** *************** ***********@mic rosoft.com:
>If you want to be able to preserve your Application variables across
app restarts, you should restore them in the Application_Sta rt 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.saunder s at trizetto.comwro te in
news:Od******** ******@TK2MSFTN GP03.phx.gbl:
"Michael Bray" <mbray@makeDInt oDot_ctiusaDcom wrote in message
news:Xn******** *************** *****@207.46.24 8.16...
>=?Utf-8?B?UGV0ZXIgQnJ vbWJlcmcgW0MjIE 1WUF0=?=
<pb*******@yah oo.yabbadabbado o.comwrote in
news:42******* *************** ************@mi crosoft.com:
>>If you want to be able to preserve your Application variables across
app restarts, you should restore them in the Application_Sta rt 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_OnS tart 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@makeDInt oDot_ctiusaDcom wrote in message
news:Xn******** *************** *****@207.46.24 8.16...
"John Saunders" <john.saunder s at trizetto.comwro te in
news:Od******** ******@TK2MSFTN GP03.phx.gbl:
>"Michael Bray" <mbray@makeDInt oDot_ctiusaDcom wrote in message
news:Xn******* *************** ******@207.46.2 48.16...
>>=?Utf-8?B?UGV0ZXIgQnJ vbWJlcmcgW0MjIE 1WUF0=?=
<pb*******@ya hoo.yabbadabbad oo.comwrote in
news:42****** *************** *************@m icrosoft.com:
If you want to be able to preserve your Application variables across
app restarts, you should restore them in the Application_Sta rt 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_OnS tart 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.saunder s at trizetto.comwro te in
news:uN******** ******@TK2MSFTN GP04.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.saunder s at trizetto.comwro te in
news:uN******** ******@TK2MSFTN GP04.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
5607
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??? And then sometimes when the conditions are correct, it doens't redirect. It appears to be very inconsistent. Any suggestions would be greatly appreciated. //Check for repeat name $result = mysql_query("SELECT * FROM survey WHERE FirstName =
18
3501
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 (from GUIs built with wxPython) and publish realtime data updates to them. Any advice on where to start? Thanks. A.B.
4
1788
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 asking this because if i set an application variable in the web application project and retrieve its value in another page(page.aspx) the application variable comes with the vatue i set on the global.asax, but if a do the same on the empty web...
4
3531
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 myVar as string, etc. It seems to me that the scope and duration are the same, as they both are there while the application is running, and both go away when it quits. I presume that one difference is that the application state can be "flushed," such...
20
4454
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 logic layer(so far so good and easy).I initialize my class which is using a FileSystemWatcher in my Global.asax and everything works fine.I have found FileSystemWatcher class not very reliable and sometimes it behavies unexpectedly.I'm afriad that...
3
1449
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, the amount of memory required to store all their session variables would very quickly exhaust the web server's memory. Also, if the application is to run on a web farm, there is no guarantee that all requests for a session will be dealt with by the...
3
4153
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 this is very annoying. So, I added a messagebox to my hidden StartAppForm in the Unload event. Now when the application closes the user is presented with a message so they can abort closing in case they don't really want to close. This has been...
9
4541
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 TypeOf obj Is IDisposable Then DirectCast(obj, IDisposable).Dispose()
2
1434
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 form below. I know the basics about IF conditions and have read plenty of them without difficulty but this one is really confusing me. There is a long, complicated IF condition (1 AND and 2 ORS, with 2 parts to each OR and 2 NOTs!), then a list...
0
8465
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8383
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8894
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8803
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8587
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7407
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4206
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1787
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.