Solved

Detect when IIS7 web app not in use

Posted on 2013-02-03
7
332 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 78

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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
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…

691 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