Re: [Mono-list] mono-service doesn't start my service - no errors
but my service doesn't seem to start. I have no error messages, except: Jan 20 21:17:47 mylaptop mono: MyHal.Service.exe: Log file already exists: /tmp/MyHal.Service.exe.lock Try using /usr/bin/mono/usr/lib/mono/1.0/mono-service.exe MyHal.Service.exe on a command line and see if there are any messages. Same thing, no messages. But I've found that the call to log4net.Config.XmlConfigurator.ConfigureAndWatch stops the programs. I've changed my Main method to: try { error(Main1, Begin); log4net.Config.XmlConfigurator.Configure(new FileInfo(System.IO.Path.GetFullPath(log4net.config))); error(Main1, Begin2); ServiceBase.Run(new ServiceBase[] { new MyHal.Service.Service1() }); error(Main1, End); } catch(Exception exc) { error(Main exception, exc.ToString()); } Here I see in syslog the firt message (Begin). If I put in comment the log4net call I see Begin2 method ; but then I think that the MyHal.Engine.Core.Instance.Init(); in the OnStart method does nothing... (the Core class has a static ctor with an error message that is never displayed) It's rather hard to debug what mono-service does or doesn't... JC http://sourceforge.net/projects/myhal - Original Message From: Jörg Rosenkranz [EMAIL PROTECTED] To: jcmag [EMAIL PROTECTED] Sent: Sunday, January 21, 2007 4:33:25 PM Subject: Re: [Mono-list] mono-service doesn't start my service - no errors Hi JC, but my service doesn't seem to start. I have no error messages, except: Jan 20 21:17:47 mylaptop mono: MyHal.Service.exe: Log file already exists: /tmp/MyHal.Service.exe.lock Try using /usr/bin/mono/usr/lib/mono/1.0/mono-service.exe MyHal.Service.exe on a command line and see if there are any messages. I've also another question: after the call to mono-service, the service is installed on the machine and will be executed, or do we have to do something for that? mono-service is only a tool to run your service. You have to provide a startup script for your specific distribution to run the service. HTH, Joerg. It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar. http://tools.search.yahoo.com/toolbar/features/mail/___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] mono-service doesn't start my service - no errors
Hi, I've developped a Service that works on Windows. I'm trying to use it on Linux (Ubuntu 6.10), with the following command: bash mono-service MyHal.Service.exe but my service doesn't seem to start. I have no error messages, except: Jan 20 21:17:47 mylaptop mono: MyHal.Service.exe: Log file already exists: /tmp/MyHal.Service.exe.lock (when I re-run the command several times) Here is my main function: static class Program { static void error (string prefix, string format, params object [] args) { Mono.Unix.Native.Syscall.syslog (Mono.Unix.Native.SyslogLevel.LOG_ERR, String.Format ({0}: {1}, prefix, String.Format (format, args))); } static void Main() { error(Main1, Begin); ServiceBase.Run(new ServiceBase[] { new MyHal.Service.Service1() }); error(Main1, End); } } (in syslog I see only the Begin message) and here is my service: public class Service1 : ServiceBase { private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public const string MyServiceName = MyHal; static void error (string prefix, string format, params object [] args) { Mono.Unix.Native.Syscall.syslog (Mono.Unix.Native.SyslogLevel.LOG_ERR, String.Format ({0}: {1}, prefix, String.Format (format, args))); } static Service1() { error(Service1, static constructor!!!); Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); } public Service1() { InitializeComponent(); } private void InitializeComponent() { this.ServiceName = MyServiceName; } protected override void Dispose(bool disposing) { base.Dispose(disposing); } protected override void OnStart(string[] args) { try { log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(log4net.config)); MyHal.Engine.Core.Instance.Init(); } catch (Exception exc) { _log.Fatal(Exception : + exc.Message); throw; } } protected override void OnStop() { try { MyHal.Engine.Core.Instance.Shutdown(); } catch (Exception exc) { _log.Fatal(Exception : + exc.Message); throw; } } } (the static constructor!!! message doesn't appear in syslog) I am a Linux beginner so I don't know what to do now. I've also another question: after the call to mono-service, the service is installed on the machine and will be executed, or do we have to do something for that? Thanks in advance JC http://sourceforge.net/projects/myhal Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Access Denied in Socket constructor
It was 1000 (It was hard-coded in a library). Changed it and now it works. Thanks for your quick answer! Jean-Christophe -- http://sourceforge.net/projects/myhal - Original Message From: Nuno Marques [EMAIL PROTECTED] To: jcmag [EMAIL PROTECTED]; mono-list@lists.ximian.com Sent: Sunday, January 14, 2007 9:31:14 PM Subject: Re: [Mono-list] Access Denied in Socket constructor What port are you using? If it is below 1024, IIRC, you need to be root to use it. nuno On Sun, 14 Jan 2007 19:54:44 -, jcmag [EMAIL PROTECTED] wrote: In my program I created a Socket: Socket s = new Socket(endPoint.Address.AddressFamily, SocketType.Stream, Protocol.Tcp); If I run my program like this: sudo mono myProgram.exe (I am on Ubuntu 6.10) It works. If I run my program without sudo, I have the following exception: System.Net.Sockets.SocketException: Access denied at System.Net.Sockets.Socket.Bind (System.Net.EndPoint local_end) [0x0] Is there another way than using sudo to run my program? Thanks TV dinner still cooling? Check out Tonight's Picks on Yahoo! TV. http://tv.yahoo.com/ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Access Denied in Socket constructor
In my program I created a Socket: Socket s = new Socket(endPoint.Address.AddressFamily, SocketType.Stream, Protocol.Tcp); If I run my program like this: sudo mono myProgram.exe (I am on Ubuntu 6.10) It works. If I run my program without sudo, I have the following exception: System.Net.Sockets.SocketException: Access denied at System.Net.Sockets.Socket.Bind (System.Net.EndPoint local_end) [0x0] Is there another way than using sudo to run my program? Thanks TV dinner still cooling? Check out Tonight's Picks on Yahoo! TV. http://tv.yahoo.com/___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list