从Windows服务加载GUI应用程序 [英] Loading GUI App from Windows Service

查看:143
本文介绍了从Windows服务加载GUI应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个.NET Windows服务,其作用是启动一个GUI应用程序(其来源是不可用)。
中的操作是发射后不管,除了最初的命令行参数没有沟通。

I am writing a .NET Windows service whose role is to launch a GUI application(whose source is unavailable). The operation is a fire and forget, no communication besides initial command-line parameters.

该服务应该作为一个给定的Windows帐户运行。

The service ought to run as a given Windows account.

问题:该服务启动的应用程序是的的显示在桌面上。它需要的,因为它是一个交互式应用程序。该解决方案是什么

Problem: The app that the service launches is not displayed on the desktop. It needs to be, as it is an interactive app. What is the solution?

注意:这是在说明书和系统的设计。登录时,GUI元素正确显示:与服务/应用通信和安全提出的典型关注的不适用的在这种特殊情况下

Note: this is the specification and the design of the system. The typical concerns raised with service/app communication and security do not apply in this specific case.

编辑。在作为本地系统帐户,但是,由于GUI应用程序需要访问网络驱动器(它不能理解UNC映射),它需要被运行作为一个指定的用户帐户,并且不具有显示交互式元素设置

edit: The GUI elements display correctly when logged in as the Local System account, however, due to the GUI app needing to access networked drives(It can't understand UNC mapping), it needs to be run as a specified user account, and that does not have a "display interactive elements" setting.

EDIT2:该操作系统是Windows 2003服务器,并且没有计划升级它

edit2: The OS is Windows 2003 Server, and there are no plans to upgrade it.

推荐答案

这是不幸的是,更多的问题,因为Vista的......一些细节,为什么张贴在的这个博客帖子。

This is, unfortunately, more problematic since Vista... Some details as to why are posted on this blog post.

这帖子有一对夫妇潜在的解决方法提供一些参考。 这里是MSDN线程,详细描述了整个过程,有些则可能面临的潜在打嗝。

That post has some references to a couple of potential workarounds. Here is a thread on MSDN that details the entire process, and some of the potential hiccups you may face.

不过,我会强烈建议想看看是否可以切​​换到其运行作为启动应用程序(当用户登录)的用户模式应用程序,并为您服务的任何通信通过应用程序来处理。它更可靠,尤其是在Vista中,终端服务,以及其他情形。

However, I'd highly recommend trying to see if you can switch to having a user-mode application run as a startup app (when the user logs in), and any communication to your service be handled by that application. It's much more reliable, especially under vista, terminal services, and other situations.

这篇关于从Windows服务加载GUI应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆