What is the difference between a service and a standard exe




















Jul 2nd, , AM 1. EXE Can someone tell me the difference here? Jul 2nd, , AM 2. A standard. Any program you write will compile to a standard. It contains classes which can be referenced and instantiated from within a standard.

In short, if you want to write a program, open a standard. Read up on COM if you need to know about this. Jul 2nd, , AM 3. In general this means that your app won't be bogged down when you tell your ActiveX. You can also accomplish many of these same tasks in the Services node in Server Explorer or by using the ServiceController class. The compiled executable file that a service application project creates must be installed on the server before the project can function in a meaningful way.

You cannot debug or run a service application by pressing F5 or F11; you cannot immediately run a service or step into its code. Instead, you must install and start your service, and then attach a debugger to the service's process. Unlike some types of projects, you must create installation components for service applications.

The installation components install and register the service on the server and create an entry for your service with the Windows Services Control Manager. The Main method for your service application must issue the Run command for the services your project contains.

The Run method loads the services into the Services Control Manager on the appropriate server. If you use the Windows Services project template, this method is written for you automatically. Note that loading a service is not the same thing as starting the service.

See "Service Lifetime" below for more information. Windows Service applications run in a different window station than the interactive station of the logged-on user. A window station is a secure object that contains a Clipboard, a set of global atoms, and a group of desktop objects. Because the station of the Windows service is not an interactive station, dialog boxes raised from within a Windows service application will not be seen and may cause your program to stop responding.

Similarly, error messages should be logged in the Windows event log rather than raised in the user interface. The Windows service classes supported by the. NET Framework do not support interaction with interactive stations, that is, the logged-on user. NET Framework also does not include classes that represent stations and desktops.

If your Windows service must interact with other stations, you will need to access the unmanaged Windows API. For more information, see the Windows SDK documentation.

The interaction of the Windows service with the user or other stations must be carefully designed to include scenarios such as there being no logged on user, or the user having an unexpected set of desktop objects.

In some cases, it may be more appropriate to write a Windows application that runs under the control of the user. Windows service applications run in their own security context and are started before the user logs into the Windows computer on which they are installed.

You should plan carefully what user account to run the service within; a service running under the system account has more permissions and privileges than a user account. A service goes through several internal states in its lifetime. First, the service is installed onto the system on which it will run.

You would use a windows service for things that always need to run even if nobody is logged in. You would use a standard EXE for programs that a user will run while logged in.

Improve this answer. Eric J. But how does it differ from using Task Scheduler to run a process in an isolated session and set the trigger to when the computer starts?

Also the service could be set to be started only manually. Greg Hewgill Greg Hewgill k gold badges silver badges bronze badges. Technically correct but I don't think it answers the question very well.

See Eric J's answer. I definitely think this is a much more correct answer than the one chosen. The other one responds better to the question "What is a Windows service".

It needs all the privileges of the logged-in user no more, no less Choose a service if: It may need to run when no one is logged in It doesn't generally need per-user data or privilege It solely communicates with the network It needs to expose new "securable" objects. It needs special permissions that may not be available to the logged-in user. David Gladfelter David Gladfelter 4, 2 2 gold badges 23 23 silver badges 25 25 bronze badges. I intended the list to describe scenarios where services make sense, not circumscribing every use case for Windows services.

John Knoeller John Knoeller A service must meet some additional requirements beyond being a standard exe with no UI. Thats a service if I am not mistaken? One more thing worth mentioning is that a service does run as a specific user, much like an portable executable exe does. By default most services run as the local SYSTEM user, but applications may choose to create their own user in an effort to control resource access.

Sign up or log in Sign up using Google.



0コメント

  • 1000 / 1000