I built a windows service, targeted for .NET 2.0 in VS 2008. I run it as a console app to debug it.
Console app is working great. I put it on my local computer as a service, compiled in debug mode, still working great. I'm ready to release now, and suddenly, when I set it to release mode, the service compiles and installs, but nothing happens. (No code in service is running at all).
I realize that the release vs debug mode are property configuration settings, but it seems that in release mode, even when I check define DEBUG constant, uncheck Optimize code, and set Debug info to 'full', it is still doing nothing.
Set it back to debug and it's working like a charm again.
(As a sidenote, I tried resetting the target framework to 3.5 to make sure that wasn't the issue, too)
So my questions (in order of importance) are these:
Will using my "debug" version in any way ever cause any problems?
What settings are different between debug and release besides the three I've been trying to change already?
This seems like a weird error to me and has stirred up my curiosity. Any idea what would cause this?
EDIT: Should mention, I already am using a custom installer. Basically I compile the program (in either debug or release) and then install it with the respective installer.
System.ServiceProcess.ServiceBase.EventLoginstance to write messages to the Event Viewer as your service starts up. For example, in theOnStart()callback, write a message indicating you've at least got that far. This will help you narrow down where the problem is occurring. Chances are, your service is triggering an exception that is shutting it down. If so, putting a try-catch block in theMain()function of your service and writing a message to the Event Viewer in the catch block that includes the stack trace will show you precisely where the problem occurs. - Matt Davis