By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

Running as service

P: n/a
Hello,

I am trying to run a process continuously as a service. The process is
to Read from a PLC and write it into a text file. But it does not work
I dont know where the bug exists as debug is not allowed for a window
service project. Same code if i put in a form and run as windows
application it works. so please help me what difference it must be
having running as service and running as application.

thanks in advance

s031278

Aug 1 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"031278" <s0*****@yahoo.comwrote in message
news:11**********************@j4g2000prf.googlegro ups.com...
Hello,

I am trying to run a process continuously as a service. The process is
to Read from a PLC and write it into a text file. But it does not work
I dont know where the bug exists as debug is not allowed for a window
service project. Same code if i put in a form and run as windows
application it works. so please help me what difference it must be
having running as service and running as application.

thanks in advance
You can attach the debugger to a Service project's code. If I recall, you
can't debug the code on the OnStart and OnStop events, the last time I
looked.

http://aspalliance.com/1316_Working_...al_Studio_2005

Aug 1 '07 #2

P: n/a
031278 wrote:
I am trying to run a process continuously as a service. The process is
to Read from a PLC and write it into a text file. But it does not work
I dont know where the bug exists as debug is not allowed for a window
service project.
Of course it is, you just can't modify the code while you're debugging.

Start the service, then attach the IDE to the running process and away
you go. If you think there's a problem in OnStart then add a fairly
hefty Sleep() call as the first statement to give you time to attach the
debugger.
Same code if i put in a form and run as windows
application it works. so please help me what difference it must be
having running as service and running as application.
They run in different user and security contexts.
For example, if the service runs as the Local System account, your
service won't know anything about the network.

HTH,
Phill W.
Aug 1 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.