从服务启动新的用户会话 [英] Starting a new user session from a service

查看:143
本文介绍了从服务启动新的用户会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:

这是一个服务,我需要开始在用户会话中的应用程序。没有人的用户登录在该机器上,因为它是一个服务器。启动的应用程序必须有一个会话!= 0。

From a service I need to start an application in a user session. No human user log on that machine, since it is a server. Launched application must have a session != 0.

当前的解决方案

我曾经在机器启动时计划任务,该任务启动(会话0,当然)启动同一台机器上远程桌面登录的应用程序:这将创建一个用户会话> 0,在用户启动的是最终的应用推出。它的工作原理,但太麻烦。

I used a scheduled task at machine startup, that task launch ( in session 0, of course ) an application launching a Remote Desktop logon on the same machine: this creates a user session > 0 and in the user startup the is the final application to launch. It works, but too tricky.

有一些最聪明的方式?至关重要的是,我已经可以在重用用户会话,因为有可能没有用户登录。

Is there some smartest way? It is critical that I can reuse a user session already on since there is potentially no user logged on.

重大更新

了大量的研究和部分成功,也感谢有关特定pourpose创建一个用户的一些系统管理员缺乏灵活性好以后,我决定使用的OpenGL 而不是WPF的渲染会话0
打破了3D部分令人惊讶的是花了不到预期。我觉得有这个问题作为一个参考可能是其他谁想要尝试呈现一个 Viewport3D 从服务非常有用。

Well after a lot of research and partial successes, and also thanks to some SysAdmin inflexibility about creating an user for a specific pourpose, I decided to use OpenGL instead of WPF for render the 3d portion broken in Session 0. Surprisingly it took less than expected. I think having this question as a reference could be useful to other who want try to render a Viewport3D from a service.

推荐答案

我不知道我理解正确的话您的需求,但也许只是定的凭据启动过程和重定向的输入和输出是你需要的。开始定的凭据的过程:

I'm not sure I understand correctly your needs, but maybe just starting process with given credentials and redirect input and output is what you need. Starting process with given credentials:

  Process p = new Process();

  p.StartInfo = new ProcessStartInfo(fileName, args);
  p.StartInfo.UserName = userName;
  p.StartInfo.Password = pass;

  p.Start();

您可能还需要重定向应用的输入和输出。这个问题在此的条每页

You may also need to redirect input and output of the application. That problem is well described on CodeProjecgt in this artice.

这篇关于从服务启动新的用户会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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