Search code examples
c#windows-servicescomparisonwindows

What is the difference between a windows service and a regular application?


I have only created regular windows applications (C# mostly). What differentiates a windows service from a regular windows application? What makes them different? What can a service do that an application can't? What are the differences seen from a developers point of view? How do you create one? Is it just to create a regular application (Console application maybe, since there are no gui?) and run or install it in a special way, or is it more that has to be done?


Solution

  • There are a couple of things that jump out to me immediately.

    • They run in an entirely different console starting with Vista
    • As a result of running in a different console, services cannot interact with the desktop. So essentially there is no direct UI support. You typically have to code a sibling UI application that does run as a normal program and uses some mechanism (named pipes for example) to communicate with the service.
    • Typically only one instance of your service can be running at any given time.
    • Processes are per user, services are per work station and hence often provide services for multiple users.