嗨,我正在尝试使用mono-service2从visual studio运行一个股票Windows服务项目.我正在使用mono 2.0和编译器在debian上运行它.
gmcs *.cs -pkg:dotnet
我尝试从这开始(我尝试使用-d设置为dir与app和-n,-m设置)
mono-service2 -l:service.lock --debug Program.exe
唯一的代码更改是添加用于测试的writelines
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...."); } } }
结果是这个错误
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]
谢谢你的帮助
回答
我错过了LD____LIBRARY____PATH env变量,因此我将其添加到csh中进行测试
#!/bin/csh setenv LD_LIBRARY_PATH .:/usr/local/lib mono-service2 -l:service.lock --debug Program.exe
Tomalak.. 9
你的LD_LIBRARY_PATH指向哪里?是否libMonoPosixHelper.so
在那里?
你的LD_LIBRARY_PATH指向哪里?是否libMonoPosixHelper.so
在那里?