I tried using a windows service with a timer but the limitation of windows service is that a user can stop the service.
This is not a limitation of Windows Services. It is a limitation of the fact that the user owns the computer and can therefore do basically whatever they want to or with it.
There is no way to create an application that cannot be stopped or quit. Even if you somehow managed to figure out a way to hide your app from Task Manager, a semi-computer-literate user could find another Task Manager-style program that would allow them to quit your application.
Windows (and all other end-user operating systems) are specifically designed and programmed to prevent this type of exceptionally user-hostile behavior, and for very good reason.
This is not a programming problem, and you'll never find a solution through that route. This is something you need to solve through the use of Group Policies in collaboration with your system administrator. Group Policy is the built-in feature that Windows has for limiting the amount of control that individual users have over their computer, including the ability to end tasks and/or stop services.
Ask more questions about this over on Server Fault.
发布评论
评论(2)
这不是 Windows 服务的限制。这是一个限制,因为用户拥有计算机,因此基本上可以做任何他们想做的事情或用它做任何事情。
没有办法创建不能停止或退出的应用程序。即使您设法找到一种方法从任务管理器中隐藏您的应用程序,半懂计算机的用户也可以找到另一个任务管理器风格的程序,允许他们退出您的应用程序。
Windows(以及所有其他最终用户操作系统)经过专门设计和编程,旨在防止这种异常的用户敌对行为,并且有充分的理由。
这不是一个编程问题,并且您永远无法通过该途径找到解决方案。您需要与系统管理员合作使用组策略来解决这个问题。组策略是 Windows 的内置功能,用于限制单个用户对其计算机的控制量,包括结束任务和/或停止服务的能力。
在服务器故障上询问更多有关此问题的问题。
This is not a limitation of Windows Services. It is a limitation of the fact that the user owns the computer and can therefore do basically whatever they want to or with it.
There is no way to create an application that cannot be stopped or quit. Even if you somehow managed to figure out a way to hide your app from Task Manager, a semi-computer-literate user could find another Task Manager-style program that would allow them to quit your application.
Windows (and all other end-user operating systems) are specifically designed and programmed to prevent this type of exceptionally user-hostile behavior, and for very good reason.
This is not a programming problem, and you'll never find a solution through that route. This is something you need to solve through the use of Group Policies in collaboration with your system administrator. Group Policy is the built-in feature that Windows has for limiting the amount of control that individual users have over their computer, including the ability to end tasks and/or stop services.
Ask more questions about this over on Server Fault.
注意:
听起来像病毒! :)
您需要有一个伙伴进程或另一个进程来定期检查该进程是否存在。如果没有找到,则重新启动它。
NOTE:
Sounds like a virus! :)
You need to have a buddy process or another process that periodically checks for presence of this process. If not found, then restart it.