views:

2982

answers:

3

Hi I'm trying to use mono-service2 to run a stock Windows Service Project from visual studio. I'm running this on debian with mono 2.0 and compiling with.

gmcs *.cs -pkg:dotnet

I try and start with this (I've tried with -d set to the dir with the app and -n,-m set)

mono-service2 -l:service.lock --debug Program.exe

The only code change is to add writelines for testing

Service1.cs

using System;
using System.ServiceProcess;

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

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

        protected override void OnStop()
        {
            Console.WriteLine("stopping....");
        }
    }
}

The resulting is this error

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Native.Syscall ---> System.DllNotFoundException: libMonoPosixHelper.so
  at (wrapper managed-to-native) Mono.Unix.Native.Syscall:_L_ctermid ()
  at Mono.Unix.Native.Syscall..cctor () [0x00000]
  --- End of inner exception stack trace ---
  at MonoServiceRunner.Main (System.String[] args) [0x00000]

Thanks for your help

Answer

I was missing the LD____LIBRARY____PATH env variable, so I added it in a csh for a test

#!/bin/csh
setenv LD_LIBRARY_PATH .:/usr/local/lib
mono-service2 -l:service.lock --debug Program.exe
+3  A: 

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

Tomalak
Thanks it wasn't set properly
Scott Cowan
A: 

Make sure you have libmono0 installed.

Claymore
+1  A: 

Best place to ask questions like this is http://lists.ximian.com/mailman/listinfo/mono-list [[email protected]]

abatishchev