简体   繁体   English

无法使用单声道加载文件或程序集 System.Net.Http

[英]Could not load file or assembly System.Net.Http using mono

I am developing a discord bot in C# and to have it 24/7 I plan to host it in a pi zero with mono because the zero cannot run net core我正在用 C# 开发一个 discord bot 并让它 24/7 我计划用单声道将它托管在 pi 零中,因为零无法运行网络核心

I am using visual studio 2019 to make it targeting .NET Framework 4.6.2, after compiling I get a Release folder with the exe and a bunch of dll libraries then try to run the program in my pi using我正在使用 Visual Studio 2019 使其面向 .NET Framework 4.6.2,编译后我得到一个包含 exe 和一堆 dll 库的 Release 文件夹,然后尝试使用我的 pi 在我的 pi 中运行该程序

mono 'discord bot net framework.exe'

in my windows 10 PC it works fine but when I try to run it on the pi I get the following error:在我的 Windows 10 PC 中,它运行良好,但是当我尝试在 pi 上运行它时,出现以下错误:

Unhandled Exception: System.TypeLoadException: Could not load type of field 'Discord.Net.Rest.DefaultRestClient:_client' (1) due to: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.未处理的异常:System.TypeLoadException:无法加载字段“Discord.Net.Rest.DefaultRestClient:_client”(1) 的类型,原因是:无法加载文件或程序集“System.Net.Http,版本=4.2.0.0,文化” =neutral, PublicKeyToken=b03f5f7f11d50a3a' 或其依赖项之一。 at Discord.API.DiscordRestApiClient.SetBaseUrl (System.String baseUrl) [0x00011] in <790e6351624946dea6c24efa0b8ebeb3>:0 at Discord.API.DiscordRestApiClient..ctor (Discord.Net.Rest.RestClientProvider restClientProvider, System.String userAgent, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x0006a] in <790e6351624946dea6c24efa0b8ebeb3>:0 at Discord.API.DiscordSocketApiClient..ctor (Discord.Net.Rest.RestClientProvider restClientProvider, Discord.Net.WebSockets.WebSocketProvider webSocketProvider, System.String userAgent, System.String url, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x00021] in :0 at Discord.WebSocket.DiscordSocketClient.CreateApiClient (Discord.WebSocket.DiscordSocketConfig config) [0x00020] in :0 at Discord.WebSocket.DiscordSocketClient..ctor (Di在 Discord.API.DiscordRestApiClient.SetBaseUrl (System.String baseUrl) [0x00011] in <790e6351624946dea6c24efa0b8ebeb3>:0 在 Discord.API.DiscordRestApiClient..ctor (Discord.Net.DiscordRestApiClient..ctor (Discord.Net.RestClientStringProvider,RestMode.Net.RestClientStringProvider,RestMode) defaultRetryMode、Newtonsoft.Json.JsonSerializer 序列化器、Discord.RateLimitPrecision rateLimitPrecision、System.Boolean useSystemClock) [0x0006a] in <790e6351624946dea6c24efa0b8ebeb3>:0 在 Discord.API.Discord. .WebSockets.WebSocketProvider webSocketProvider, System.String userAgent, System.String url, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x00021] in :0 at Discord.WebSocket.Discord.WebSocket.Discord .CreateApiClient (Discord.WebSocket.DiscordSocketConfig config) [0x00020] in :0 at Discord.WebSocket.DiscordSocketClient..ctor (Di scord.WebSocket.DiscordSocketConfig config) [0x00000] in :0 at Not_traso.StartUp.ConfigureServices (Microsoft.Extensions.DependencyInjection.IServiceCollection services) [0x00015] in :0 at Not_traso.StartUp.RunAsync () [0x0001e] in :0 at Not_traso.StartUp.RunAsync (System.String[] args) [0x00065] in :0 at Not_traso.Program.Main (System.String[] args) [0x00060] in :0 at Not_traso.Program. scord.WebSocket.DiscordSocketConfig config) [0x00000] in :0 at Not_traso.StartUp.ConfigureServices (Microsoft.Extensions.DependencyInjection.IServiceCollection services) [0x00015] in :0 at Not_traso.StartUp.RunAsync () [0x00001e] Not_traso.StartUp.RunAsync (System.String[] args) [0x00065] in :0 at Not_traso.Program.Main (System.String[] args) [0x00060] in :0 at Not_traso.Program。 (System.String[] args) [0x0000c] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type of field 'Discord.Net.Rest.DefaultRestClient:_client' (1) due to: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. (System.String[] args) [0x0000c] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: 无法加载字段“Discord.Net.Rest.DefaultRestClient:_client”(1) 的类型,原因是:无法加载文件或程序集“System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。 at Discord.API.DiscordRestApiClient.SetBaseUrl (System.String baseUrl) [0x00011] in <790e6351624946dea6c24efa0b8ebeb3>:0 at Discord.API.DiscordRestApiClient..ctor (Discord.Net.Rest.RestClientProvider restClientProvider, System.String userAgent, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x0006a] in <790e6351624946dea6c24efa0b8ebeb3>:0 at Discord.API.DiscordSocketApiClient..ctor (Discord.Net.Rest.RestClientProvider restClientProvider, Discord.Net.WebSockets.WebSocketProvider webSocketProvider, System.String userAgent, System.String url, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x00021] in :0 at Discord.WebSocket.DiscordSocketClient.CreateApiClient (Discord.WebSocket.DiscordSocketConfig config) [0x00020] in :0 at Discord.WebSocket.DiscordSocketClient..ctor (Di在 Discord.API.DiscordRestApiClient.SetBaseUrl (System.String baseUrl) [0x00011] in <790e6351624946dea6c24efa0b8ebeb3>:0 在 Discord.API.DiscordRestApiClient..ctor (Discord.Net.DiscordRestApiClient..ctor (Discord.Net.RestClientStringProvider,RestMode.Net.RestClientStringProvider,RestMode) defaultRetryMode、Newtonsoft.Json.JsonSerializer 序列化器、Discord.RateLimitPrecision rateLimitPrecision、System.Boolean useSystemClock) [0x0006a] in <790e6351624946dea6c24efa0b8ebeb3>:0 在 Discord.API.Discord. .WebSockets.WebSocketProvider webSocketProvider, System.String userAgent, System.String url, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x00021] in :0 at Discord.WebSocket.Discord.WebSocket.Discord .CreateApiClient (Discord.WebSocket.DiscordSocketConfig config) [0x00020] in :0 at Discord.WebSocket.DiscordSocketClient..ctor (Di scord.WebSocket.DiscordSocketConfig config) [0x00000] in :0 at Not_traso.StartUp.ConfigureServices (Microsoft.Extensions.DependencyInjection.IServiceCollection services) [0x00015] in :0 at Not_traso.StartUp.RunAsync () [0x0001e] in :0 at Not_traso.StartUp.RunAsync (System.String[] args) [0x00065] in :0 at Not_traso.Program.Main (System.String[] args) [0x00060] in :0 at Not_traso.Program. scord.WebSocket.DiscordSocketConfig config) [0x00000] in :0 at Not_traso.StartUp.ConfigureServices (Microsoft.Extensions.DependencyInjection.IServiceCollection services) [0x00015] in :0 at Not_traso.StartUp.RunAsync () [0x00001e] Not_traso.StartUp.RunAsync (System.String[] args) [0x00065] in :0 at Not_traso.Program.Main (System.String[] args) [0x00060] in :0 at Not_traso.Program。 (System.String[] args) [0x0000c] in :0 (System.String[] args) [0x0000c] 在 :0

I installed mono with sudo apt install mono-complete and updated to the latest version,我用 sudo apt install mono-complete 安装了单声道并更新到最新版本,

running mono --version gives运行 mono --version 给出

Mono JIT compiler version 6.12.0.122 (tarball Mon Feb 22 17:44:05 UTC 2021) Mono JIT 编译器版本 6.12.0.122(tarball Mon Feb 22 17:44:05 UTC 2021)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors.版权所有 (C) 2002-2014 Novell, Inc、Xamarin Inc 和贡献者。 www.mono-project.com www.mono-project.com
TLS: __thread TLS:__线程
SIGSEGV: normal SIGSEGV:正常
Notifications: epoll通知:epoll
Architecture: armel,vfp+hard架构:armel,vfp+hard
Disabled: none禁用:无
Misc: softdebug其他:软调试
Interpreter: yes口译员:是
LLVM: yes(610) LLVM:是(610)
Suspend: preemptive暂停:抢先
GC: sgen (concurrent by default) GC:sgen(默认并发)

I have tried to install System.Net.Http with NuGet latest version and some previous versions but it doesn't work我试图用 NuGet 最新版本和一些以前的版本安装 System.Net.Http 但它不起作用

I haven't used a pi or Linux before so I don't know where to even look for missing libraries or what to do我以前没有使用过 pi 或 Linux,所以我什至不知道在哪里寻找丢失的库或做什么

事实证明,discord net 无论如何都不支持单声道,所以我无能为力,哦,好吧。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集&#39;System.Net.Http - Could not load file or assembly 'System.Net.Http 无法加载文件或程序集&#39;System.Net.Http&#39; - Could not load file or assembly 'System.Net.Http' "无法加载文件或程序集 System.Net.Http 版本 4.1.1.0" - Could not load file or assembly System.Net.Http version 4.1.1.0 无法加载文件或程序集 System.Net.Http 4.2.0.0 - could not load file or assembly System.Net.Http 4.2.0.0 System.Net.Http - 无法加载文件或程序集,然后无法加载要执行的引用程序集 - System.Net.Http - Could not load file or assembly, then Cannot load a reference assembly for execution 无法加载文件或程序集&#39;System.Net.Http,版本= 4.2.0.0系统找不到指定的文件 - Could not load file or assembly 'System.Net.Http, Version=4.2.0.0 The system cannot find the file specified 无法加载文件或程序集&#39;System.Net.Http,Version = 4.1.0.0 .net framework 4.6 .net standard 1.3 - Could not load file or assembly 'System.Net.Http, Version=4.1.0.0 .net framework 4.6 .net standard 1.3 无法加载文件或程序集&#39;System.Net.Http,Version = 4.1.1.1 .Net Standard - Could not load file or assembly 'System.Net.Http, Version=4.1.1.1 .Net Standard Azure失败无法加载文件或程序集&#39;System.Net.Http,版本= 4.2.0.0 - Azure failing Could not load file or assembly 'System.Net.Http, Version=4.2.0.0 无法加载文件或程序集“System.Net.Http”或其依赖项之一 - Could not load file or assembly 'System.Net.Http' or one of its dependencies
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM