Quantcast

mono-service2 issues for Pause and Continue signals

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

mono-service2 issues for Pause and Continue signals

srinin
Hi All,

I have a simple windows service application that just puts the console output when ever service receives stop, start or pause and continue signals.

I am able to run the service in Mac using mono-service2. i am able to see console outputs for start and stop not for the Pause and Continue... signals. I want to know whether mono-service has any issues in mac????

My code is,


static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
                        {
                                new Service1()
                        };
            ServiceBase.Run(ServicesToRun);
        }
    }

 public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            Console.WriteLine("Start............");
        }
       
        protected override void OnStop()
        {
            Console.WriteLine("Stop............");
        }

        protected override void OnPause()
        {
            Console.WriteLine("Pause............");
        }

        protected override void OnContinue()
        {
            Console.WriteLine("Continue............");
        }
    }


I am running the service with following commands

mono-service2 --debug <myservicename.exe>
>> it prints start on console

And for Pause
kill -USR1 `cat /tmp/myservicename.lock`
>>But no console output
And for continue
kill -USR2 `cat /tmp/myservicename.lock`
>>no console output
And for stop
kill `cat /tmp/myservicename.lock`
>>it prints stop on console

And also i observe whenever i stop the service cpu usage is increased to greater thn > 99%

Kindly help me in solving this issue

Regards
Srini


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mono-service2 issues for Pause and Continue signals

srinin
We need to set the variable CanPauseAndContinue to true.

Regards
Srini
Loading...