The library 'libhostpolicy.so' required to execute the application was not found

江枫思渺然 提交于 2021-02-08 21:07:07

问题


During running a dotnet console application I encountered this error. I ran it from a directory that had the .dll and .pdb file copied into it.

What is the cause of this error?


回答1:


the deps.json and runtimeconfig.json must also be copied into the directory that the .dll is invoked in. Without these files you will encounter this error.

If you're doing post-build copies, make sure to include these files.




回答2:


Please check chmod of application folder. When I change folder access mode, problem was resolved. I know it is a little weird but sometimes it can be related to that :)

You have to determine them like that;

sudo chown -R yourusername:yourusername /var/www/
sudo setfacl -R -d -m u:yourusername:rwx,g:yourusername:rwx,o::r /var/www/

If you don't have setfacl command please install ACL package via this command;

sudo apt install acl

If this doesn't work, please use this command when publishing your project(in Package Manager Console of Visual Studio);

dotnet publish -c Release --self-contained --runtime linux-x64 -o out

And it will create "out" folder in your solution directory, you can copy its contain to server.



来源:https://stackoverflow.com/questions/50605927/the-library-libhostpolicy-so-required-to-execute-the-application-was-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!