1

I have just created a windows service. Since there isn't really a way to debug services(that I know of)I created the majority of the application as a desktop console application that accessed the libraries I created that it uses. When doing this everything worked great. So once I created the service to do the same job the console was doing(all the console did was open and automatically start it's job) and installed it with sc.exe and started it up, it doesn't seem to be doing it's job which is basically listening for connections.

Is there anything else I have to do for my service to be able to access these libraries? Do I have to somehow register them so they will work together? This is a standard windows service created in C#.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
user1632018
  • 2,485
  • 10
  • 52
  • 87
  • Does the service run, or does it stop right after you start it? Does it throw any errors? Do you do any logging? – Joel Coehoorn Sep 13 '13 at 04:52
  • @user1632018 You can debug the service. After hosting the service you have to attach that process. – Kurubaran Sep 13 '13 at 05:30
  • I know its a couple of months later this answer but...Your problem is not the library... its the process itself. Use this Thread, I was able to create my own solution for this problem since many had the problem noone gave the solution to it directly. [My Solution](http://stackoverflow.com/questions/19776716/c-sharp-windows-service-creates-process-but-doesnt-executes-it?noredirect=1#comment29510963_19776716) – S.H. Nov 08 '13 at 19:14
  • 1
    @StevenHernandez You are a genious! I pretty much gave up on it thinking I wouldn't be able to do it with that process. I am really glad you came over here to help me out. Feel free to post the answer here and I will accept it. – user1632018 Nov 09 '13 at 04:39
  • @user1632018 Thanks :) I am so glad it solved your problem. Took me spme days to figure it out. But I was amazed at how many have this problem and noone was given a real solution. One guy as an answer posted he had solved it but that it was company code so he couldn't share it. – S.H. Nov 09 '13 at 12:04
  • Remember to accept the answer when possible please. thanks – S.H. Nov 09 '13 at 23:42

1 Answers1

1

I am so glad you got it working. I know i have seen many have this problem.... And to think my own question about it got down voted. But anyways these are called Loader Service(by Microsoft) not Windows Service. They are the same thing except the former has the ability to interact with GUI.


I know its a couple of months later this answer but...Your problem is not the library... its the process itself. Use this Thread, I was able to create my own solution for this problem since many had the problem but noone gave the solution to it directly. My Solution - C# Windows Service Creates Process but doesn't executes it

Community
  • 1
  • 1
S.H.
  • 2,833
  • 3
  • 26
  • 28
  • Thanks again Steven. I am soo glad you came around with the solution. Like I said before, I was ready to throw in the towel. Even though I still needed a solution. I appreciate it. – user1632018 Nov 10 '13 at 02:48
  • Great! So glad it help. If you have any question for any modification on the code just ask hehe. – S.H. Nov 10 '13 at 02:51