简体   繁体   English

通过Windows服务访问在本地主机上运行的Lync的当前实例时,出现异常“主机进程未运行”

[英]When accessing current instance of Lync running on localhost by Windows service, I get the exception “host process is not running”

I am accessing current instance of Lync running in my local computer by window service. 我正在通过窗口服务访问在本地计算机上运行的Lync的当前实例。 I have installed windows service which executes exe, this exe access the current instance of lync and when i was running this service, it gives exception 我已经安装了执行exe的Windows服务,该exe访问lync的当前实例,当我运行此服务时,它会给出异常

host process is not running exception message: Microsoft.Lync.Model.LyncClient.EnsureOI() at Microsoft.Lync.Model.LyncClient.GetClient(Boolean sideBySideLync) 主机进程未运行异常消息:Microsoft.Lync.Model.LyncClient.GetClient(Boolean sideBySideLync)上的Microsoft.Lync.Model.LyncClient.EnsureOI()

Also I am running the service as the same user that's running the lync.exe process. 另外,我以与运行lync.exe进程相同的用户身份运行服务。

What you are trying to do is not possible. 您试图做的事是不可能的。 The service user session is not the same as the local desktop user session. 服务用户会话与本地桌面用户会话不同。 That is why service applications can't create UI (any longer), is the same reason you can't access Lync.exe as Lync.exe is not running in your service users session. 这就是服务应用程序无法再创建UI的原因,与无法访问Lync.exe的原因相同,因为服务用户会话中未运行Lync.exe。 If it did, you would not be able to see it as it would run in the service session. 如果是这样,您将无法看到它,因为它将在服务会话中运行。

You have to run your application as a normal desktop application. 您必须将应用程序作为普通桌面应用程序运行。 It doesn't have to have a UI, it can run in background. 它不必具有UI,它可以在后台运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM