I have a Windows service that uses the Microsoft Lync 2010 SDK. When I run the service locally, everything seems to be running as expected. When I try deploying the code to a VM, when I try starting a service, it errors out saying
The Foo service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.
Looking at event viewer, I see an exception
Service cannot be started. Microsoft.Lync.Model.LyncClientException: Generic COM Exception. Code is 0x80080005.
at Microsoft.Lync.Model.LyncClient.EnsureOI()
at Microsoft.Lync.Model.LyncClient.GetClient()
I tried installing Visual studio and the windows lync 2010 SDK on the VM but that did not fix the problem either. Is there anything else I should be trying?
EDIT:
A combination of restarting the VM and restarting the lync client seems to fix the issue but that is the most unsatisfying solution.
You are using the Lync Client SDK and a prerequisite for this is that the Lync Client is installed and running on that machine. https://msdn.microsoft.com/en-us/library/office/hh378549(v=office.14).aspx
As you are writing a windows service I suspect that you don't want the Lync Client present in which case you may want to the enable ui suppression mode https://msdn.microsoft.com/en-us/library/office/jj933224.aspx
If installing the Lync Client isn't an option then you may want to consider using the UCMA API which may be a better fit for a server based solution anyway https://msdn.microsoft.com/en-us/library/office/dn454984.aspx