How do I configure the timeout used by UI0Detect (Interactive Services Detection service)?


Windows Vista introduced Session 0 Isolation which enforces the rule that services should not display UI. If a service tries to display UI, another service known as the Interactive Services Detection service detects this situation and signals the user that a service wants to display UI and gives the user an opportunity to switch to the service desktop, respond to the UI, and then switch back. If the user ignores the service for about one minute, it switches back automatically, on the assumption that something went bad with the detection and the service is actually finished with its UI. (That way, the user doesn't get stuck staring at session 0 forever.)

More than one customer wanted to know how to configure this one minute timeout.

The correct solution to the problem is not to configure Interactive Services Detection but rather to fix your service so it doesn't show UI in session 0.

It's like saying, "When I mail a letter and get the postal code wrong, the letter reaches the destination eventually, but it takes much longer than a letter sent with the correct postal code. How can I get letters sent with the incorrect postal code to reach their destination faster?"

The answer is to stop putting the incorrect postal code on your letters.

In other words, stop throwing garbage on the sidewalk.

Bonus reading: Troubleshooting Interactive Services Detection.

Comments (10)
  1. Grzechooo says:

    I'd call it "using global state to manage a local problem".

  2. People should never have created services with UI in the first place. Have programmers and developers not heard of the word "purpose"?

  3. Joshua says:

    @Fleet Command: NT4 through XP had the checkbox "Allow Service to Interact With Desktop" when reconfiguring services. I used to set this on IIS so MsgBox would work in web code (for debugging).

  4. Dan Bugglin says:

    @Joshua That just means MS fell into the same trap as others who made services with UI.

    Visual Studio probably provides proper debugging mechanisms for whatever you were doing (I've never used IIS and I don't know what language you were dealing with).

  5. Joshua says:

    @The MAZZTer: Borland C++ 4.5's debugger didn't work too well in 32 bit mode.

    Service with UI is the obvious solution to the problem of needing an elevated UI for specific tasks. The fact it's inherently dangerous just wasn't well understood back in the day.

  6. cheong00 says:

    @Fleet Command: With introduction of .NET, modifying existing application to run as service has never been as easy. My previous company also have loads of programs that originally written as winform program that later moved on to run as service when they're "repurposed" to be running on servers.

    The negative side is most people do their porting just "good enough to run as service", but neglected to convert all the message popups from messagebox/dialogs to log files / eventviewer logs.

  7. IanG says:

    What if I'm using an old 3rd party service that I didn't write that occasionally does this to me? Perhaps I've pleaded with the company to fix it but aren't getting anywhere. I can see that in that situation I'd want to be able to change the timeout, to try to make my machine usable until such time as I can get the vendor to fix the problem.

  8. ender says:

    This reminds me of setting up an archive server for certain ultrasound machines. Part of install involved switching to session 0 when the reminder popped up, logging in to remote desktop that appeared there (while saving credentials – this was important), then switching back to regular desktop and disabling Interactive services detection, so it would stop bugging whoever was using the server.

  9. Neil says:

    Why would the user stare at session 0 forever? I'm sure I remember seeing UI to return from session 0 too.

  10. Slashdotter says:

    The whole "interactive programs in session 0" is a tricky business. If I want to run Selenium (a browser automation program) as a service it's going to end up doing so in session 0 (bear in mind it needs to be able to scrape the screen if the user requests a screenshot). Normally it's no problem that everything is hidden but there are times when its useful to be able to to see what's going on and I click the UI0Detect prompt only to have my Remote Desktop Connection close a little while later. Now I know why the Remote Desktop connection was spontaneously closing – I was staring into session 0 for too long. Another snag seems to be that Internet Explorer can no longer write its cache directory when running in session 0 so its not an easy business…

Comments are closed.

Skip to main content