Windows Service Question

  • Thread starter Thread starter Nathan Kovac
  • Start date Start date
N

Nathan Kovac

I have a windows service project created with a timer that fires an event
over and over. I created an installer & the service appears to install
correctly. When I try to start the service I get a message that the service
started and stopped. Is there some setting I need to do to make the service
keep going until I tell it to stop?

Thanks,
Nathan
 
When a service stops this usually means an exception is being thrown or some
other problem.

Look in the "Administrative Tools > Event Viewer"

In the application event log, you should find an entry with your service's
name.

-Brian
 
Thanks, I was tring to run a trace to a file and file permissions were not
there. After removing this code and trying to reinstall the service I keep
getting a message that the specified service is marked for deletion. Does
this mean I need to reboot every time I retry my service?

Thanks,
Nathan
 
I've never had an error when uninstalling a service. The error is from InstallUtil.exe?

Can you post the error?

As a side note, when I write services, I put all the code I can in a DLL
project, and in the service project I just put the timer and event handling
to call the DLL. I also add a console app project, and I use the console
app to debug the DLL. This way you're not having to run the service to debug
the DLL if it has problems. Of course, this doesn't test everything, but
I find it very helpful.

--Brian
 
Brian,
I eventually got everything to work.

I had to manually delete the folder the project had installed to. I haven't
had a problem since.

I had previously used a windows form for a testing harness. Even the timers
were in the dlls. I had done some things that I wasn't allowed to do like I
had my database location saved in an xml file and was logging trace to a txt
file. I updated it to log the trace to sql and for the time being made the
connection string hardcoded.

I was able to get my service to work correctly. Thank you very much.

Nathan
 
Back
Top