title: Testing Windows DOTNET Service on Linux using mono-service
body: <p>I'm trying to run a Windows .NET-4.0 service on Linux using mono-service. It's not compiled with mono or anything. I'm not 100% it's doable but I thought I could try (binary compatible etc, seems <a href="http://mattdeboard.net/2012/10/19/how-to-run-windows-service-as-linux-daemon/" rel="nofollow">doable</a>?). Correct me if I'm wrong. </p>
  
  <p>I'm getting errors that it can't find some dlls. They are in the system but it's not finding them. Here's one.</p>
  
  <pre><code>$ ldconfig -p | grep Posix
      libMonoPosixHelper.so (libc6,x86-64) =&gt; /usr/lib/libMonoPosixHelper.so
  </code></pre>
  
  <p>I try with adding the path etc but no change.</p>
  
  <pre><code>$ MONO_LOG_LEVEL=debug mono-service MyService.exe --debug &gt; output.log
  </code></pre>
  
  <p>or</p>
  
  <pre><code>$ MONO_PATH=/usr/lib MONO_LOG_LEVEL=debug mono-service MyService.exe --debug &gt; output.log
  </code></pre>
  
  <p>or LD_LIBRARY_PATH, which was empty, so I tried</p>
  
  <pre><code>export LD_LIBRARY_PATH=/usr/lib
  </code></pre>
  
  <p>Always like this in the output:</p>
  
  <pre><code>Mono: DllImport attempting to load: 'libMonoPosixHelper.so'.
  Mono: DllImport loading library: '/usr/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libMonoPosixHelper.so'.
  Mono: DllImport error loading library '/usr/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libMonoPosixHelper.so: cannot open shared object file: No such file or directory'.
  Mono: DllImport loading library: '/usr/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libMonoPosixHelper.so'.
  Mono: DllImport error loading library '/usr/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libMonoPosixHelper.so: cannot open shared object file: No such file or directory'.
  Mono: DllImport loading location: 'libMonoPosixHelper.so'.
  </code></pre>
  
  <p>So it's not finding it in the base path, just looking in the GAC. Why isn't it looking there? It should look in MONO_PATH before GAC? Am I missing something?</p>
  
  <p>Tested on two VMs: Ubuntu 13.04 and a clean live Mint 14.</p>
  
  <h2>edit, add info 9/10:</h2>
  
  <p>Ok, Ubuntu had version 2.10 or something, I tried with the latest source </p>
  
  <pre><code>$ sudo ./autogen.sh --prefix=/usr/local
  $ sudo make
  $ sudo make install
  $ mono --version
  Mono JIT compiler version 3.2.1 (tarball Tue Sep 10 12:25:30 CEST 2013)
  Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
      TLS:           __thread
      SIGSEGV:       altstack
      Notifications: epoll
      Architecture:  amd64
      Disabled:      none
      Misc:          softdebug 
      LLVM:          supported, not enabled.
      GC:            sgen
  $ LD_LIBRARY_PATH=/usr/local/lib MONO_LOG_LEVEL=info mono-service MyService.exe --debug &gt; output.log    
  </code></pre>
  
  <p>output.log:  </p>
  
  <pre><code>Mono: Assembly Loader probing location: '/usr/lib/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/4.5/mscorlib.dll'.
  Mono: Image addref mscorlib[0xdb0130] -&gt; /usr/local/lib/mono/4.5/mscorlib.dll[0xdaf370]: 2
  Mono: Assembly Loader probing location: '/usr/lib/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/4.5/mscorlib.dll'.
  Mono: AOT loaded AOT Module for /usr/local/lib/mono/4.5/mscorlib.dll.
  
  Mono: Assembly Loader loaded assembly from location: '/usr/local/lib/mono/4.5/mscorlib.dll'.
  Mono: Config attempting to parse: '/usr/local/lib/mono/4.5/mscorlib.dll.config'.
  Mono: Config attempting to parse: '/usr/local/etc/mono/assemblies/mscorlib/mscorlib.config'.
  Mono: GC_MAJOR: (mature allocation failure) pause 0.16ms, total 0.16ms, bridge 0.00 major 96K/32K los 0K/0K
  Mono: Assembly mscorlib[0xdb0130] added to domain mono-service.exe, ref_count=1
  Mono: Config attempting to parse: '/usr/local/etc/mono/config'.
  Mono: Config attempting to parse: '/home/ejpb/.mono/config'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/4.5/mono-service.exe'.
  Mono: Image addref mono-service[0xdf0660] -&gt; /usr/local/lib/mono/4.5/mono-service.exe[0xdae210]: 3
  Mono: Assembly mono-service[0xdf0660] added to domain mono-service.exe, ref_count=1
  Mono: AOT failed to load AOT module /usr/local/lib/mono/4.5/mono-service.exe.so: /usr/local/lib/mono/4.5/mono-service.exe.so: cannot open shared object file: No such file or directory
  
  Mono: Assembly Loader loaded assembly from location: '/usr/local/lib/mono/4.5/mono-service.exe'.
  Mono: Config attempting to parse: '/usr/local/lib/mono/4.5/mono-service.exe.config'.
  Mono: Config attempting to parse: '/usr/local/etc/mono/assemblies/mono-service/mono-service.config'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/4.5/mono-service.exe'.
  Mono: AOT failed to load AOT module /usr/local/lib/mono/4.5/mono-service.exe.so: /usr/local/lib/mono/4.5/mono-service.exe.so: cannot open shared object file: No such file or directory
  
  Mono: Assembly Ref addref mono-service[0xdf0660] -&gt; mscorlib[0xdb0130]: 2
  Mono: Config attempting to parse: '/usr/local/lib/mono/4.5/mono-service.exe.config'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/4.5/Mono.Posix.dll'.
  Mono: Image addref Mono.Posix[0xe0bba0] -&gt; /usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll[0xe0ae00]: 2
  Mono: Assembly Mono.Posix[0xe0bba0] added to domain mono-service.exe, ref_count=1
  Mono: AOT failed to load AOT module /usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll.so: /usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll.so: cannot open shared object file: No such file or directory
  
  Mono: Assembly Loader loaded assembly from location: '/usr/local/lib/mono/4.5/Mono.Posix.dll'.
  Mono: Config attempting to parse: '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll.config'.
  Mono: Config attempting to parse: '/usr/local/etc/mono/assemblies/Mono.Posix/Mono.Posix.config'.
  Mono: Assembly Ref addref mono-service[0xdf0660] -&gt; Mono.Posix[0xe0bba0]: 2
  Mono: Assembly Ref addref Mono.Posix[0xe0bba0] -&gt; mscorlib[0xdb0130]: 3
  Mono: DllImport attempting to load: 'libc.so.6'.
  Mono: DllImport error loading library '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libc.so.6': '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libc.so.6: cannot open shared object file: No such file or directory'.
  Mono: DllImport error loading library '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libc.so.6.so': '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libc.so.6.so: cannot open shared object file: No such file or directory'.
  Mono: DllImport loaded library 'libc.so.6'.
  Mono: DllImport searching in: 'libc.so.6' ('libc.so.6').
  Mono: Searching for 'chdir'.
  Mono: Probing 'chdir'.
  Mono: Found as 'chdir'.
  Mono: DllImport attempting to load: 'libMonoPosixHelper.so'.
  Mono: DllImport error loading library '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libMonoPosixHelper.so': '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libMonoPosixHelper.so: cannot open shared object file: No such file or directory'.
  Mono: DllImport error loading library '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libMonoPosixHelper.so': '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/libMonoPosixHelper.so: cannot open shared object file: No such file or directory'.
  Mono: DllImport loaded library 'libMonoPosixHelper.so'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Syscall_open_mode'.
  Mono: Probing 'Mono_Posix_Syscall_open_mode'.
  Mono: Found as 'Mono_Posix_Syscall_open_mode'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Syscall_lockf'.
  Mono: Probing 'Mono_Posix_Syscall_lockf'.
  Mono: Found as 'Mono_Posix_Syscall_lockf'.
  Mono: DllImport searching in: 'libc.so.6' ('libc.so.6').
  Mono: Searching for 'getpid'.
  Mono: Probing 'getpid'.
  Mono: Found as 'getpid'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Syscall_write'.
  Mono: Probing 'Mono_Posix_Syscall_write'.
  Mono: Found as 'Mono_Posix_Syscall_write'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Syscall_get_at_fdcwd'.
  Mono: Probing 'Mono_Posix_Syscall_get_at_fdcwd'.
  Mono: Found as 'Mono_Posix_Syscall_get_at_fdcwd'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Syscall_L_ctermid'.
  Mono: Probing 'Mono_Posix_Syscall_L_ctermid'.
  Mono: Found as 'Mono_Posix_Syscall_L_ctermid'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Syscall_L_cuserid'.
  Mono: Probing 'Mono_Posix_Syscall_L_cuserid'.
  Mono: Found as 'Mono_Posix_Syscall_L_cuserid'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Syscall_get_utime_now'.
  Mono: Probing 'Mono_Posix_Syscall_get_utime_now'.
  Mono: Found as 'Mono_Posix_Syscall_get_utime_now'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Syscall_get_utime_omit'.
  Mono: Probing 'Mono_Posix_Syscall_get_utime_omit'.
  Mono: Found as 'Mono_Posix_Syscall_get_utime_omit'.
  Mono: DllImport searching in: 'libc.so.6' ('libc.so.6').
  Mono: Searching for 'free'.
  Mono: Probing 'free'.
  Mono: Found as 'free'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_malloc'.
  Mono: Probing 'Mono_Posix_Stdlib_malloc'.
  Mono: Found as 'Mono_Posix_Stdlib_malloc'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_SIG_DFL'.
  Mono: Probing 'Mono_Posix_Stdlib_SIG_DFL'.
  Mono: Found as 'Mono_Posix_Stdlib_SIG_DFL'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_SIG_ERR'.
  Mono: Probing 'Mono_Posix_Stdlib_SIG_ERR'.
  Mono: Found as 'Mono_Posix_Stdlib_SIG_ERR'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_SIG_IGN'.
  Mono: Probing 'Mono_Posix_Stdlib_SIG_IGN'.
  Mono: Found as 'Mono_Posix_Stdlib_SIG_IGN'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib__IOFBF'.
  Mono: Probing 'Mono_Posix_Stdlib__IOFBF'.
  Mono: Found as 'Mono_Posix_Stdlib__IOFBF'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib__IOLBF'.
  Mono: Probing 'Mono_Posix_Stdlib__IOLBF'.
  Mono: Found as 'Mono_Posix_Stdlib__IOLBF'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib__IONBF'.
  Mono: Probing 'Mono_Posix_Stdlib__IONBF'.
  Mono: Found as 'Mono_Posix_Stdlib__IONBF'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_BUFSIZ'.
  Mono: Probing 'Mono_Posix_Stdlib_BUFSIZ'.
  Mono: Found as 'Mono_Posix_Stdlib_BUFSIZ'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_EOF'.
  Mono: Probing 'Mono_Posix_Stdlib_EOF'.
  Mono: Found as 'Mono_Posix_Stdlib_EOF'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_FOPEN_MAX'.
  Mono: Probing 'Mono_Posix_Stdlib_FOPEN_MAX'.
  Mono: Found as 'Mono_Posix_Stdlib_FOPEN_MAX'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_FILENAME_MAX'.
  Mono: Probing 'Mono_Posix_Stdlib_FILENAME_MAX'.
  Mono: Found as 'Mono_Posix_Stdlib_FILENAME_MAX'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_L_tmpnam'.
  Mono: Probing 'Mono_Posix_Stdlib_L_tmpnam'.
  Mono: Found as 'Mono_Posix_Stdlib_L_tmpnam'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_stderr'.
  Mono: Probing 'Mono_Posix_Stdlib_stderr'.
  Mono: Found as 'Mono_Posix_Stdlib_stderr'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_stdin'.
  Mono: Probing 'Mono_Posix_Stdlib_stdin'.
  Mono: Found as 'Mono_Posix_Stdlib_stdin'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_stdout'.
  Mono: Probing 'Mono_Posix_Stdlib_stdout'.
  Mono: Found as 'Mono_Posix_Stdlib_stdout'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_TMP_MAX'.
  Mono: Probing 'Mono_Posix_Stdlib_TMP_MAX'.
  Mono: Found as 'Mono_Posix_Stdlib_TMP_MAX'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_EXIT_FAILURE'.
  Mono: Probing 'Mono_Posix_Stdlib_EXIT_FAILURE'.
  Mono: Found as 'Mono_Posix_Stdlib_EXIT_FAILURE'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_EXIT_SUCCESS'.
  Mono: Probing 'Mono_Posix_Stdlib_EXIT_SUCCESS'.
  Mono: Found as 'Mono_Posix_Stdlib_EXIT_SUCCESS'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_MB_CUR_MAX'.
  Mono: Probing 'Mono_Posix_Stdlib_MB_CUR_MAX'.
  Mono: Found as 'Mono_Posix_Stdlib_MB_CUR_MAX'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Stdlib_RAND_MAX'.
  Mono: Probing 'Mono_Posix_Stdlib_RAND_MAX'.
  Mono: Found as 'Mono_Posix_Stdlib_RAND_MAX'.
  Mono: Assembly mscorlib[0xdb0130] added to domain MyService.exe, ref_count=4
  Mono: Config attempting to parse: '/home/ejpb/mono-3.2.1/MyService.exe.config'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll'.
  Mono: Image addref Mono.Security[0xf159c0] -&gt; /usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll[0xf296f0]: 2
  Mono: Assembly Mono.Security[0xf159c0] added to domain MyService.exe, ref_count=1
  Mono: AOT failed to load AOT module /usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll.so: /usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll.so: cannot open shared object file: No such file or directory
  
  Mono: Assembly Loader loaded assembly from location: '/usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll'.
  Mono: Config attempting to parse: '/usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll.config'.
  Mono: Config attempting to parse: '/usr/local/etc/mono/assemblies/Mono.Security/Mono.Security.config'.
  Mono: Assembly Ref addref Mono.Security[0xf159c0] -&gt; mscorlib[0xdb0130]: 5
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/4.5/Mono.Security.dll'.
  Mono: Unloading image /usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll [0x1003f10].
  Mono: Assembly Mono.Security[0xf159c0] added to domain mono-service.exe, ref_count=2
  Mono: AOT failed to load AOT module /usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll.so: /usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll.so: cannot open shared object file: No such file or directory
  
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/gac/mono-service/4.0.0.0__0738eb9f132ed756/mono-service.dll'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono-service.dll'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/4.5/Facades/mono-service.dll'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/gac/mono-service/4.0.0.0__0738eb9f132ed756/mono-service.exe'.
  Mono: Image addref mono-service[0x109a0b0] -&gt; /usr/local/lib/mono/gac/mono-service/4.0.0.0__0738eb9f132ed756/mono-service.exe[0x106e200]: 2
  Mono: Assembly mono-service[0x109a0b0] added to domain MyService.exe, ref_count=1
  Mono: AOT failed to load AOT module /usr/local/lib/mono/gac/mono-service/4.0.0.0__0738eb9f132ed756/mono-service.exe.so: /usr/local/lib/mono/gac/mono-service/4.0.0.0__0738eb9f132ed756/mono-service.exe.so: cannot open shared object file: No such file or directory
  
  Mono: Assembly Loader loaded assembly from location: '/usr/local/lib/mono/gac/mono-service/4.0.0.0__0738eb9f132ed756/mono-service.exe'.
  Mono: Config attempting to parse: '/usr/local/lib/mono/gac/mono-service/4.0.0.0__0738eb9f132ed756/mono-service.exe.config'.
  Mono: Config attempting to parse: '/usr/local/etc/mono/assemblies/mono-service/mono-service.config'.
  Mono: Assembly Ref addref mono-service[0x109a0b0] -&gt; mscorlib[0xdb0130]: 6
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/gac/System.ServiceProcess/4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll'.
  Mono: Image addref System.ServiceProcess[0x10bf5f0] -&gt; /usr/local/lib/mono/gac/System.ServiceProcess/4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll[0x10be7a0]: 2
  Mono: Assembly System.ServiceProcess[0x10bf5f0] added to domain MyService.exe, ref_count=1
  Mono: AOT failed to load AOT module /usr/local/lib/mono/gac/System.ServiceProcess/4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll.so: /usr/local/lib/mono/gac/System.ServiceProcess/4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll.so: cannot open shared object file: No such file or directory
  
  Mono: Assembly Loader loaded assembly from location: '/usr/local/lib/mono/gac/System.ServiceProcess/4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll'.
  Mono: Config attempting to parse: '/usr/local/lib/mono/gac/System.ServiceProcess/4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll.config'.
  Mono: Config attempting to parse: '/usr/local/etc/mono/assemblies/System.ServiceProcess/System.ServiceProcess.config'.
  Mono: Assembly Ref addref mono-service[0x109a0b0] -&gt; System.ServiceProcess[0x10bf5f0]: 2
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll'.
  Mono: Image addref System[0x10c0fc0] -&gt; /usr/local/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll[0x10c0290]: 2
  Mono: Assembly System[0x10c0fc0] added to domain MyService.exe, ref_count=1
  Mono: AOT failed to load AOT module /usr/local/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll.so: /usr/local/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll.so: cannot open shared object file: No such file or directory
  
  Mono: Assembly Loader loaded assembly from location: '/usr/local/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll'.
  Mono: Config attempting to parse: '/usr/local/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll.config'.
  Mono: Config attempting to parse: '/usr/local/etc/mono/assemblies/System/System.config'.
  Mono: Assembly Ref addref System.ServiceProcess[0x10bf5f0] -&gt; System[0x10c0fc0]: 2
  Mono: Assembly Ref addref System[0x10c0fc0] -&gt; mscorlib[0xdb0130]: 7
  Mono: Assembly Ref addref System.ServiceProcess[0x10bf5f0] -&gt; mscorlib[0xdb0130]: 8
  Mono: Assembly Loader probing location: 'MyService.exe'.
  Mono: Assembly Loader probing location: '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll'.
  Mono: Assembly Mono.Posix[0xe0bba0] added to domain MyService.exe, ref_count=3
  Mono: AOT failed to load AOT module /usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll.so: /usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll.so: cannot open shared object file: No such file or directory
  
  Mono: Assembly Ref addref mono-service[0x109a0b0] -&gt; Mono.Posix[0xe0bba0]: 4
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_Syscall_syslog'.
  Mono: Probing 'Mono_Posix_Syscall_syslog'.
  Mono: Found as 'Mono_Posix_Syscall_syslog'.
  Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').
  Mono: Searching for 'Mono_Posix_FromSyslogLevel'.
  Mono: Probing 'Mono_Posix_FromSyslogLevel'.
  Mono: Found as 'Mono_Posix_FromSyslogLevel'.
  Mono: GC_MAJOR: (user request) pause 1.18ms, total 1.20ms, bridge 0.00 major 704K/272K los 50K/120K
  Mono: Unloading domain mono-service.exe[0xdaafb0], assembly __MetadataTypes[0x1025240], ref_count=1
  Mono: Unloading assembly __MetadataTypes [0x1025240].
  Mono: Unloading image __MetadataTypes [0x1003fc0].
  Mono: Unloading image __MetadataTypes [0x102dba0].
  Mono: Unloading domain mono-service.exe[0xdaafb0], assembly mscorlib[0xdb0130], ref_count=8
  Mono: Unloading domain mono-service.exe[0xdaafb0], assembly mono-service[0xdf0660], ref_count=1
  Mono: Unloading assembly mono-service [0xdf0660].
  Mono: Unloading domain mono-service.exe[0xdaafb0], assembly Mono.Posix[0xe0bba0], ref_count=4
  Mono: Unloading domain mono-service.exe[0xdaafb0], assembly Mono.Security[0xf159c0], ref_count=2
  Mono: Unloading image /usr/local/lib/mono/4.5/mono-service.exe [0xdae210].
  Mono: Assembly image '/usr/local/lib/mono/gac/System.ServiceProcess/4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/4.5/mscorlib.dll' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/4.5/mscorlib.dll' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/gac/mono-service/4.0.0.0__0738eb9f132ed756/mono-service.exe' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll' still loaded at shutdown.
  Mono: Assembly image '/usr/local/lib/mono/gac/System.ServiceProcess/4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll' still loaded at shutdown.
  </code></pre>
  
  <p>Seems better, but it's still shutting down.  </p>
  
  <p>It finds libMonoPosixHelper<br>
      <code>Mono: DllImport loaded library 'libMonoPosixHelper.so'.</code><br>
  But fails on Posix:<br>
      <code>Mono: AOT failed to load AOT module /usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll.so: /usr/local/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll.so: cannot open shared object file: No such file or directory</code><br>
  at the end of the log. Is that the main error that causes the shutdown?<br>
  Mono.Posix.dll is loaded earlier... I don't know if I'm missing something when reading the log.</p>
  
  <h2>edit 9/30</h2>
  
  <p>OK, I tried with a CrunchBang vm, it has no Mono. Installed tarball with prefix /home/ejpb/mono (needed space, on /home partition).<br>
  Question: am I even doing it correctly? I have copied the exe and dll's from the installed directory on Windows. Can I use the msi file in Linux somehow (extract them from it)? Would that change anything?<br>
  I ran  </p>
  
  <pre><code>LD_LIBRARY_PATH=/home/ejpb/mono/lib MONO_LOG_LEVEL=debug mono-service -v /home/ejpb/MyService/MyService.exe --debug &gt; out.log 
  </code></pre>
  
  <p>and got in out.log: </p>
  
  <pre><code>Mono: DllImport searching in: 'libMonoPosixHelper.so' ('libMonoPosixHelper.so').  
  Mono: Searching for 'Mono_Posix_Stdlib_RAND_MAX'.  
  Mono: Probing 'Mono_Posix_Stdlib_RAND_MAX'.  
  Mono: Found as 'Mono_Posix_Stdlib_RAND_MAX'.  
  </code></pre>
  
  <p>etc, so that part seems ok now.  </p>
  
  <p>I also got quite a few "not found"<br>
      Mono: AOT NOT FOUND: System.Security.Cryptography.RNGCryptoServiceProvider:RngClose (intptr).<br>
      Mono: AOT NOT FOUND: System.Threading.InternalThread:Thread_free_internal (intptr).<br>
  etc.  </p>
  
  <p>I tried MoMA - Mono 2.8 (4.0 Profile). Is that accurate for 3.2.3 also?<br>
  I got:</p>
  
  <pre><code>Assembly                  Version    Missing  Not Implemented  Todo  P/Invoke  
  Apache.NMS.ActiveMQ.dll   1.5.3.2578    0            4          11       0  
  Apache.NMS.dll            1.5.0.2194    0            0           4       0  
  log4net.dll               1.2.11.0      0            0           6       3  
  MyServiceUtils.dll        1.0.0.0       1            0           0       0  
  MyService.exe             1.0.0.0       0            0           1       0  
  </code></pre>
  
  <p>Perhaps it's not possible to run this service? log4net has a few p/invokes etc.</p>