Using Mono-Service to Wrap a Windows Service on Linux

using mono-service to wrap a windows service on linux

Where is your LD_LIBRARY_PATH pointing to? Is libMonoPosixHelper.so in there?

How to migrate a .NET Windows Service application to Linux using mono?

Under Linux, deamons are simple background processes. No special control methods (e.g start(), stop()) are used as in Windows. Build your service as a simple (console) application, and run it in the background. Use a tool like daemonize to run a program as a Unix daemon, and remember to specify mono as the program to be activated.

As noted by others, mono-service is a host to run services built with the ServiceProcess assembly. Services built for Windows can use this method to run unmodified under Linux. You can control the service by sending signals to the process (see man page).

mono-service2 on linux for a Dotnet4 Service

I know this is 2 years late but I had the same problem.

Further investigation showed that 'mono-service2' (on my ArchLinux pc) maps to /usr/lib/mono/2.0 where as 'mono-service' maps to /usr/lib/mono/4.5

I hope this saves other people time.

Capture stack trace from crashed mono application run as a service in Linux via mono-service

Are you capturing unhandled exceptions in the application? Take a look at:

http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx

This should allow you to at least log any unhandled exceptions so you can get a better idea what's happening.

How do I code a Mono Daemon

You should implement a service and use mono-service. Google for it and you'll find several examples.

Why doesn't a mono service restart after a kill -9?

When mono starts a service, it creates a lock in /tmp based on the program name or given parameter. You should stop the service by sending the SIGTERM not SIGKILL signal - if you did so, the lock would be deleted. Now you should manually delete the lock. Read details here.

How to start a service in C# on Linux

You can execute a command by doing this;

Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "/bin/bash";
proc.StartInfo.Arguments = "-c 'your command here'";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();


Related Topics



Leave a reply



Submit