The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation


Wondering if Your Legacy Desktop Application Will Work as a Windows Service? Answer These 3 Questions to Find Out

3 Questions

Does your old (but important) desktop application need to run all the time?

Should it start immediately after a reboot, even when no one is there to log on and kick it off?

If so, you should consider installing your program as a Windows Service — the technology Microsoft invented to support mission-critical, 24×7 applications. Use a “service wrapper” (like our AlwaysUp) to install your application as a service in 5-10 minutes.

But not all legacy applications will operate smoothly when installed as a service. Here are three questions you should ask to determine if a windows service is a good fit for your situation:

  1. Do you need to see (or interact with) your program while it’s running?

    Windows services run in the background. Any windows displayed by a service appear on a “hidden desktop” called Session 0. When your legacy application is running as a service, you will not see its windows on your own desktop.

    As a consequence, it doesn’t make much sense to run an intensively interactive application (like a word processor) as a windows service. Indeed, any application that demands your constant attention will be a poor fit. Does yours?

    But if you only need to see your application from time to time, a service may still be an option because you can quickly switch to the Session 0 desktop whenever you need to see your application.

    For example, when running Apple’s iTunes as a windows service, here is what the Session 0 desktop looks like:

    iTunes as a Windows Service in Session 0

    Even though there is no taskbar and the usual desktop icons have vanished, we can interact with iTunes just fine in Session 0. For example, we were able to add tracks to iTunes, create a playlist, and even change settings — just as we would if iTunes was running on our regular desktop.

    (The only exception is on Windows 10 and Windows 2016, where a particularly annoying bug will prevent you from moving the mouse and keyboard in Session 0. Come on Microsoft! Please fix this defect soon.)

    So is occasionally switching to Session 0 good enough for your situation? If not, you should rule out a windows service.

  2. Will your application occasionally prompt for input?

    An application that periodically pops up windows and expects you to respond can be a problem when installed as a windows service. Those popups/windows will appear on the Session 0 desktop — effectively hidden from you. You will not know that your program is stuck waiting for you to enter a password or click the OK button!

    So a “needy” application is not a great candidate for running in the background as a windows service. Does your legacy application fit the mold?

    However, if you only have to get past one or two prompts, our AlwaysUp service wrapper may provide an elegant solution. Simply write an automation script that dismisses the prompt and plug the script into AlwaysUp. This page dives into the details.

    For example, when launching iTunes as a service, this error message is the first to appear:

    iTunes Startup Error

    Clicking the “X” in the title bar will expel the window and allow iTunes to start. To achieve the same effect when no one is around to click, we provided this simple one-line script (which sends the “ESC” key to the iTunes window) to AlwaysUp. Now AlwaysUp automatically dismisses the warning on our behalf whenever it appears!

  3. Does your application read from or write to files on a network drive?

    Like a regular application, a windows service can access remote/network devices. Permissions are granted based on the account running the service.

    However, a service can’t use a mapped drive — at least not without some extra work to explicitly map the drive letter.

    Mapping a Network Drive

    So if your legacy application references network files via their full UNC path (like “\\ServerName\ShareName\Path”) it will be fine as a windows service. But if your program uses files via a mapped drive (like “J:\Path”, where J is mapped to “\\ServerName\ShareName\”), a service may not be in your future.

    Mapped drives may not be an issue when using AlwaysUp though. Most drives will be mapped and available to your application if you check the “Attempt to automatically reconnect all network drives” box on the Startup tab when configuring your application.

Next step? Try it yourself!

If none of these questions have ruled out your legacy/desktop application, you should go ahead and try it as a windows service. Any service wrapper (like AlwaysUp) will do the trick in a few minutes. What have you got to lose?

Posted in Windows Services | Tagged , , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *