Running as service

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • 031278

    #1

    Running as service

    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

  • Mr. Arnold

    #2
    Re: Running as service


    "031278" <s031278@yahoo. comwrote in message
    news:1185952920 .129141.294980@ j4g2000prf.goog legroups.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.



    Comment

    • Phill W.

      #3
      Re: Running as service

      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.

      Comment

      Working...