p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   .NET Web Services (http://p2p.wrox.com/forumdisplay.php?f=102)
-   -   Service Starts and Stops (http://p2p.wrox.com/showthread.php?t=37760)

rodmcleay January 30th, 2006 04:18 AM

Service Starts and Stops
 
Hi all,
I have created a windows service with .net 2.
I have installed the service but when I try to start it I get a message that the service has started and stopped as there was nothing to do.
I have noticed from some other similar problems on the net that this may be due to a thread not being started for each service.
There are three seperate services that I wish to run in this process and I have started them all from the program page like so:
Code:

static void Main()
        {
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] {
                new SmsReceive(),
                new SmsSend(),
                new SmsRouting()
            };
            ServiceBase.Run(ServicesToRun);
        }

In each of the services there is code like so:
Code:

        protected override void OnStart(string[] args)
        {
            // TODO: Add code here to start your service.
            PortUtilities.OpenPort(serialPort, ReceiveGsmModemPort);
            serialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);
            Watch();           
        }

SO each has some kind of loop to continue watching either a GSM Modem or a Message Queue.

How can I get these services running in processes that will not stop?

Many thanks for your time in advance.
Rod


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================

rodmcleay January 30th, 2006 04:30 AM

My mistake, wrong forum, I've moved question to http://p2p.wrox.com/topic.asp?TOPIC_ID=39306


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================


All times are GMT -4. The time now is 05:57 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.