0

Possible Duplicate:
Service runs then dies.

Hello,

I'm running Win 7 Pro 64-bit. I wrote a service in C# using the .NET 4 framework. It installs properly and starts to run. I know that it runs because it writes some output to a log file. However, after a few seconds it dies. When I use Visual Studio 2010 Pro to run this same code not as a service it never dies. So, my obvious question is regarding the appropriate approach for debugging this since I can't figure out why it should dies as a service but not die as a non-service. I've put writes to the log file in several places in the code but it seems to die in a different place every time. The application has 3 threads. Any suggestions are welcomed.

Thanks, Ray

Community
  • 1
  • 1
Ray
  • 11
  • 1

1 Answers1

0

I suspect some sort of thread unsafe code. This is a typical symptom of code that is not thread safe. At some point two or more threads crash into each other (such as when one iterates a list, and another modifies that list).

When you are doing debugging in VS the code runs significantly slower, so it is less likely/takes longer for the threads to crash.

Automatico
  • 12,420
  • 9
  • 82
  • 110