问题
I have a simple application that starts service using topshelf and it looks simple:
HostFactory.Run(x =>
{
x.Service<RequestService>();
x.RunAsLocalSystem();
});
Well it works, but under windows when i tried this under linux I am getting:
Topshelf.Runtime.Windows.WindowsHostEnvironment Error: 0 : Unable to get parent process (ignored), System.DllNotFoundException: Unable to load shared library 'kernel32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libkernel32.dll: cannot open shared object file: No such file or directory
Did someone came across this problem? I tried to google it but someone said it works other that it is tool only for windows.
Or maybe there is some other service hoisting framework for .net core?
回答1:
Assuming that you installed this version of Topshelf - you would notice under dependencies that it doesn't support .NET Core and therefore it will not run under a Linux environment.
It will only run under a Windows environment as you mentioned in your post. kernel32.dll
is a Windows dependency that it cannot find, therefore it cannot run.
来源:https://stackoverflow.com/questions/56752046/topshelf-and-net-core-under-linux