Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've been working on a Skype bot program.

The idea is the when the user sends messages to the bot with certain keywords it will provide the results of a SQL script that is run in the background.

I've been able to get it to work as a Windows console app , but I'm trying to convert it into a Windows service.

I've tried using Top Shelf and the Visual Studio Windows service template, both are not working. I'm able to install the Windows service, but when I try to run it it fails.

I keep getting this error

C#
Service cannot be started. System.Runtime.InteropServices.COMException (0x80040200): Not attached. at SKYPE4COMLib.ISkype.Attach(Int32 Protocol, Boolean Wait)


This happens as soon as the program tries to attach its self to Skype.

C#
skype.Attach(7, true);


I've come to the conclusion that the Windows service and Skype are on different levels and cant see each other.

I was was wondering is there any way to change this or is it impossible?
Posted
Updated 6-Aug-15 3:35am
v2
Comments
F-ES Sitecore 6-Aug-15 9:30am    
I'd probably start by looking at the account the service is running under and try different ones, maybe a domain user or at least make sure it is an account with network access. If the dlls are accessing registry keys for the "current user" you might have problems, also if you need access to the desktop (showing a dialogue etc) then that will also cause you problems. For the registry issue create a user, log in as that user, setup Skype and make sure it works, then try setting that user as the account the service runs under.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900