.net core 在Linux上为自包含的.NET核心应用程序运行dotnet sos、dotnet dump、dotnet gcdump
我有一台Ubuntu18.04x64Linux服务器,运行一系列.NET核心应用程序。它们都是作为独立的应用程序发布的,.NET核心版本在2.1、3.1和5.0之间变化。我没有在机器上安装.NET核心运行时(更不用说SDK),也不想安装它 我想为.NET Core 3.1自包含应用程序运行诸如和之类的工具。链接页面为他们提供直接下载链接,例如。但是,当我运行下载的.net core 在Linux上为自包含的.NET核心应用程序运行dotnet sos、dotnet dump、dotnet gcdump,.net-core,ubuntu-18.04,sos,.net Core,Ubuntu 18.04,Sos,我有一台Ubuntu18.04x64Linux服务器,运行一系列.NET核心应用程序。它们都是作为独立的应用程序发布的,.NET核心版本在2.1、3.1和5.0之间变化。我没有在机器上安装.NET核心运行时(更不用说SDK),也不想安装它 我想为.NET Core 3.1自包含应用程序运行诸如和之类的工具。链接页面为他们提供直接下载链接,例如。但是,当我运行下载的dotnetsos工具时,它会失败 A fatal error occurred. The required library libh
dotnetsos
工具时,它会失败
A fatal error occurred. The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/var/tmp/.net/MY_USERNAME/dotnet-sos/mrdxw5vu.czm/].
If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
The .NET Core runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.18.04-x64
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
- No frameworks were found.
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=ubuntu.18.04-x64
即使当前工作目录是我的.NET应用程序目录(其中包含
libhostfxr.so
。该错误意味着可以为自包含的应用程序运行该工具,但该文件确实不存在于/var/tmp/.net/MY_USERNAME/dotnet sos/mrdxw5vu.czm/
中。如果我手动将该文件复制到上面的目录中,那么它将失败
A fatal error occurred. The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/var/tmp/.net/MY_USERNAME/dotnet-sos/mrdxw5vu.czm/].
If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
The .NET Core runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.18.04-x64
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
- No frameworks were found.
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=ubuntu.18.04-x64
如果不在计算机范围内安装.NET运行时,如何运行这些工具?我可以很容易地从中下载二进制文件,但是我应该把它们放在哪里,以便工具找到它们?结果表明.NET SDK可以提取到任何目录,然后用于安装和运行
dotnet dump
和dotnet gcdump
,如下所示:
curl -fsSL https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh | bash -s -- --no-path --install-dir ~/dotnet-sdk --channel 5.0
~/dotnet-sdk/dotnet tool install --tool-path ~/dotnet-sdk/tools dotnet-dump
DOTNET_ROOT=~/dotnet-sdk ~/dotnet-sdk/tools/dotnet-dump collect -p PID_TO_DUMP
(然而,我并没有设法让SOS在LLDB中工作。“安装”它的工作原理与上面一样,但无法在LLDB中加载。)