0

I have a selfhosting WCF Service. It is hosted by an Windows Service. I installed it with installutil. So in the bin Folder I have two Folders Debug and Release. When I install the windowsservice in the release Folder it starts as usual and hosts the WCF Service but when I install it in the debug Folder it wont start. I get this error message:

"The Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs."

Does someone know how to fix this?

Mr. Paul
  • 103
  • 3
  • 16

1 Answers1

0

Some exception occurred. Check:

  1. Your logs (if you have such)
  2. Event log
  3. If you can attach a debugger then try it, the best option is to add some diagnostic line of code example here: https://msdn.microsoft.com/en-us/library/cktt23yw.aspx
  • Could you add this line of code to your service System.Diagnostics.Debugger.Launch(); ? During start debugger will attach. – Marcin Iwanowski Jan 25 '16 at 15:03
  • I can ... but does this hit any brakepoints or what should I do? – Mr. Paul Jan 26 '16 at 15:38
  • Just try to do it :) This line of code will run the debugger (Visual Studio) and it will stop executing on that line of code. Then go through the code and check if everything executes as you expected. Debugger will also stop if any exception occurs. – Marcin Iwanowski Jan 26 '16 at 20:34
  • "The application is in break mode - Your app has entered a break state, but there is no code to Show because all threads were executing external code." I think I have an unhandled exception somewhere but I can't find it. Any ideas? – Mr. Paul Jan 27 '16 at 07:59
  • When you received that message? Maybe you should add some try catch in OnStart method? – Marcin Iwanowski Jan 27 '16 at 09:43
  • When I start my Service with the line System.Diagnostics.Debugger.Launch(); then I have to choose with which Visual Studio Version I want to compile. Then I get this error message. btw I wrapped everything in my OnStart method in try and catch and let the catch write into a txt file but it finds no exceptin :( – Mr. Paul Jan 28 '16 at 08:12
  • Please change Launch() method to Break() and try again. – Marcin Iwanowski Jan 29 '16 at 08:17
  • I set up a new Service and Launch is working now! Thanks for your help :) – Mr. Paul Jan 29 '16 at 12:07