问题描述
当我应该去为Windows服务,当我应该去,在通知区域中运行的后台应用程序?
When should I go for a Windows Service and when should I go for a "Background Application" that runs in the notification area?
如果我没有错,我的设计决定是,需要在运行前,用户登录到计算机应该是服务的任何应用程序。对于一切使用后台程序。是我的决定吧?
If I'm not wrong, my design decision would be, any app that needs to be running before the user logins to the computer should be a service. For everything else use a background app. Is my decision right?
此外,如果我需要管理员权限我的后台程序,我会用升级的清单。有没有作为服务运行的任何其他特定优势?
Moreover, if I need "admin privileges" for my background app, I would escalate using a manifest. Are there any other specific advantage of running as a service?
推荐答案
是我的经验一般规则如下:
My general rules of thumb are as follows
- 如果它需要一直运行,这是一个服务。
- 如果需要在一个特定的用户帐户下运行,网络服务,本地系统,通常它是一个服务(或COM +应用程序)
- 如果用户需要一定的控制,它通常是一个通知区域的应用程序。
- 如果它需要通知一些用户来说,这是一个通知区域的应用程序
- If it needs to always run, it's a service.
- If it needs to be run under a particular user account, Network Service, Local System, generally it's a service (or a COM+ application)
- If the user needs some control over it, it's generally a notification area application.
- If it needs to notify the user of something, it's a notification area application
乐趣来当你有需要运行的东西作为一个系统帐户,但也与它进行交互。 IIS就是一个很好的例子,这是一个服务,但管理是一个应用程序 - 它需要在启动时运行,它需要特定的东西访问的用户无法正常访问(C:\inetpub),但用户需要能够启动,停止和配置。
The fun comes when you have the need to run something as a system account, but also interact with it. IIS is a good example of this, it's a service, but the administration is an application - it needs to be running at the startup, it needs access to particular things a user can't normal access (c:\inetpub), but the user needs to be able to start, stop and configure it.
这篇关于Windows服务VS Windows应用程序 - 最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!