?
Solved

Detect when IIS7 web app not in use

Posted on 2013-02-03
7
Medium Priority
?
333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 79

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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 17

Accepted Solution

by:
Rovastar earned 750 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
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…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Suggested Courses

777 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