Solved

Detect when IIS7 web app not in use

Posted on 2013-02-03
7
327 Views
Last Modified: 2013-02-18
I need to be able to detect when no users are using a particular web app so that I can do some maintenance on the server.  I do not want to log in to the server and manually do the work.  I have a couple of services running and I am not adverse to writing another one or something scheduled or whatever but I don't want to write anything in the web app itself.  This solution needs to stand alone on the server (Windows 7).   I started looking at this namespace - Microsoft.Web.Administration  but I am not sure if this is the correct starting place.  
Thanks
LT
0
Comment
Question by:codelegs
7 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 38849457
With plain web pages, you can't tell if someone is 'using' them because they just get served as files and it's done until they request the next one.  What is there about the web app that makes it possible to detect when there aren't any 'users'?
0
 
LVL 9

Expert Comment

by:Aeriden
ID: 38849480
The problem is that I don't think you can really tell if users are connected as they move from page to page (or within a page via post-backs) except for the moment they make a call to retrieve data.  IIS also leaves some connection handles available even after visitors have closed their browser for optimization purposes.

Load Balanced IIS servers can sometimes be useful with this process (but a lot more complex and requires Windows Servers).  Or proper .NET development can allow visitors to resume even after the web server has been done for a period of time.
0
 
LVL 77

Expert Comment

by:arnold
ID: 38849627
Not sure what kind of work you need to perform on a live/production site.
You can have a test site with Athens same functionality on which you can work and test and then publish the changes to the production/live one.

As you referenced, the only way to track if someone is likely using the app is by including the mechanism within the app.
I.e. using the user login to create an entry in a database indicating initial time. Every page access updates the most recent access as a verification that the user is still accessing resource using a cookie. In the absence of updates within a set amounts time (5,10 minutes) based on the state cookie expiration, the user entry is deleted as presumptive that the user is no longer accessing the site.
With your criteria in mind, you would need to include the current page the user is on and take into account whether the component you are working on might adversely affect the users' experience.
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 17

Accepted Solution

by:
Rovastar earned 250 total points
ID: 38849720
I agree with the others above you need to understand what it means when no-one is using your app.

Also you do not say how much traffic you get, it is possible that it always has active users.  But if that is the case then you really need to look at web farm and load balancing environments for your setup.

From an IIS admin point of view there are direct indications that the site is not being used.

When any traffic goes to the site it runs a worker process. After a period of inactivity the worker process closes by default that is 30 minutes. So if there is no worker process for that site (well, technically app pool that the site/app runs under) then it is safe to do the deployment.

I think looking at WorkerPRocessState might help here but I am no coder.
http://msdn.microsoft.com/en-us/library/microsoft.web.administration.workerprocessstate%28v=vs.90%29.aspx

Also look at how you are managing session. InProc sessions are stored in the worker process.
0
 

Author Comment

by:codelegs
ID: 38853494
Dave, I think you have helped.  But is there a session that ends on the server that would tell me no one has a session?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38854619
0
 

Author Closing Comment

by:codelegs
ID: 38903637
WorkerProcess is the correct place - thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now