终止 SYSTEM 帐户下的 ATL COM 进程?
我有一个在本地系统帐户下运行的 .NET Windows 服务。然后,该服务使用 COM Interop 在 Visual Studio 6 上运行以 ATL 编写的 COM 组件。然后,该 COM 组件在 SYSTEM 帐户下运行。我知道我可以冒充另一个帐户,但现在我想把东西留在原处。
问题是Windows服务停止后,COM组件仍然运行。我也无法杀死该进程。任务管理器不会杀死它,所以我从命令行尝试了 TaskKill。这甚至说它成功终止了进程,但当我检查任务管理器时它仍在运行。我已经尝试过 PSKill,但显示访问被拒绝。
我已经用尽谷歌寻找解决方案。有人可以帮忙吗?
另外,为什么它仍然保持运行?
I have a .NET Winddows service which runs under the Local System account. This service then runs a COM component that was written in ATL on Visual Studio 6 using COM Interop. This COM component then runs under the SYSTEM account. I know I can impersonate another account but for now I want to leave things where they are.
The problem is that after the windows service stops, the COM component remains running. I can't kill the process either. Task Manager won't kill it so I tried TaskKill from the command line. This even says it terminated the process successfully but when I check task manager it is still running. I have tried PSKill but that says access denied.
I've exhausted Google looking for a solution to this. Can anyone help?
Also, why does it remain running anyway?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
杀死一个进程只是一个权限问题。假设 Vista/7 启用了 UAC,如果您不以管理员身份运行,您将无法终止系统进程。注意 - 仅成为本地管理员组的成员是不够的。您必须使用“以管理员身份运行”启动任务管理器/进程资源管理器/ pskill 或其他任何内容,才能以管理权限实际运行它们。否则,您只是普通用户,就会被拒绝。
至于 COM 服务器仍然存在:COM 服务器有一个引用计数,只有在计数降至 0 后它们才会自行关闭。在您的情况下,服务器可能由于以下几个原因而不会关闭:
Killing a process is just a matter of permissions. Assuming Vista/7 with UAC on, you won't be able to kill a system process if you're not running as an administrator. Note - it's not enough to be a member of the local administrators group. You must launch task manager / process explorer / pskill or whatever using "Run As Administrator" to actually run them with administrative permissions. Otherwise, you're just a regular user, and you're denied.
As for the COM server sticking around: COM servers have a reference count, and they shut themselves down only after the count drops to 0. In your case, the server might not shut down due to a few reasons: