.Net App Development – How to Build a .Net App Running on Desktop and as a Windows Service

Architecturenetwcfwpf

Ok, I hope this is not too much confusing (with my poor English). I want to build a small .Net 4.0 app which monitors several other applications on a Windows Server OR on a regular Windows PC. It will have a WPF GUI with a variety of graphical controls.

The app will be used in the following scenarios:

  1. If installed on a PC it should run as a “normal” single Windows
    desktop app
  2. If installed on a Server, it should run as a Windows Service. To use/manage the app it must have the same WPF GUI as in scenario 1 and the GUI should be run on the Server or on a remote PC

At the moment I consider to write the application logic and connect it to the WPF GUI using a self-hosted WCF Data Service IN BOTH SCENARIOS. Since I’m not a pro developer I suppose it’s possible that I've missed something 😉

Will this work? Are there other/better solutions? Any answer or comment is highly appreciated.

Best Answer

You will need to write two separate parts: the service back end (which has no GUI) and the front end controller (the GUI). They will need to communicate using some form of windows interprocess communication.

Doing this as a single application may be possible, but in the windows service case it would have no GUI so still need a separate one. If you are really clever you might be able to write a single program that can be both the front and back end parts, but this probably makes the program more complicated than it needs to be.

Remember on Windows Vista and above a service has no interaction with the desktop at all.

As you say you are not a pro developer, this will be a big challenge to you. Doing what you want is complex. It is easier in .net than in plain WIN32, but be aware that your application then has a reliance on the .net framework being installed (you may need to choose your framework version carefully).

Related Topic