NET 5连mysql数据库遇到的问题
1.
System.NotSupportedException:“No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.”
解决办法:
nuget添加
代码中加入
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Encoding encoding1 = Encoding.GetEncoding(1252);
Console.WriteLine(encoding1.WebName);
Encoding encoding2 = Encoding.GetEncoding("GB2312");
Console.WriteLine(encoding2.WebName);
2.添加以上代码时,又会出现这个错误:“Could not load file or assembly ‘System.Diagnostics.PerformanceCounter, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. 系统找不到指定的文件。”
nuget添加