Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows Service to run constantly
    primarykey
    data
    text
    <p>Ive created a windows Service called <strong>ProxyMonitor</strong> and im currently at the stage where the service is installs and uninstall's the way I want it.</p> <p>So I execute the application like so:</p> <pre><code>C:\\Windows\\Vendor\\ProxyMonitor.exe /install </code></pre> <p>Pretty self explanatory, and then I got to <code>services.msc</code> and and start the service, but when I do this I get the following message:</p> <blockquote> <p>The Proxy Monitor Service on Local Computer started and then stopped. Some services stop automatically if there is no work to do, For example, The performance Logs and Alerts Services</p> </blockquote> <p>My code looks like so:</p> <pre><code>public static Main(string[] Args) { if (System.Environment.UserInteractive) { /* * Here I have my install logic */ } else { ServiceBase.Run(new ProxyMonitor()); } } </code></pre> <p>And then within ProxyMonitor class I have:</p> <pre><code>public ProxyMonitor() { } protected override void OnStart(string[] args) { base.OnStart(args); ProxyEventLog.WriteEntry("ProxyMonitor Started"); running = true; while (running) { //Execution Loop } } </code></pre> <p>and <code>onStop()</code> I just change the <code>running</code> variable to <code>false</code>;</p> <p>What would I need to do to make the Service constantly active, as I would need to be monitoring the network I need to trace changes etc.</p> <hr> <p>Update: 1</p> <pre><code>protected override void OnStart(string[] args) { base.OnStart(args); ProxyEventLog.WriteEntry("ProxyMonitor Started"); Thread = new Thread(ThreadWorker); Thread.Start(); } </code></pre> <p>Within the <code>ThreadWorker</code> I have <code>ProxyEventLogger.WriteEntry("Main thread entered")</code> which does not get fired.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload