I am accessing current instant of Lync running in my local computer in window service

StackOverflow https://stackoverflow.com/questions/23602757

  •  20-07-2023
  •  | 
  •  

I am accessing current instance of Lync running in my local computer by window service.

 public static LyncClient lyncClient;
 {
        protected override void OnStart(string[] args)
        {

               lyncClient = LyncClient.GetClient(); // I am getting error here at run time

         }
}

I installed this service and when i was running this service, I got error message "The MyService service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or program."

I checked Event Viewer. It showed following exception:

Service cannot be started. Microsoft.Lync.Model.ClientNotFoundException: The host process is not running at Microsoft.Lync.Model.LyncClient.EnsureOI() at Microsoft.Lync.Model.LyncClient.GetClient(Boolean sideBySideLync) at TestService.ACD.OnStart(String[] args) in g:\TestService\TestService\ACD.cs:line 53 at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)

But i have signed in Lync Client.

pls give me a solution to fix this issue.

有帮助吗?

解决方案

You need to make sure you're running the service as the same user that's running the lync.exe process (probably yourself). If you're running the service as another identity (such as Network Service) it won't be able to access the lync.exe process, and will give you that error.

-tom

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top