小编Thi*_*aud的帖子

net 5.0 无法确定帧大小或收到损坏的帧

我想尝试net5.0,因为它在rc2中,并且我遇到了一个奇怪的问题。

我在net5.0中创建了一个默认的WebApi。我没有碰任何东西,只是单击“运行”(在 Kestrel 中,而不是 ISS),Swagger 主页就会显示。我尝试了 WeatherForcast get,一切正常。

招摇索引页面

然后我在 NET5.0 中创建了一个控制台应用程序并添加了以下代码:

static async Task Main(string[] args)
{
    var clientHandler = new HttpClientHandler
    {
        ServerCertificateCustomValidationCallback = (_, _, _, _) => true
    };
    var client = new HttpClient(clientHandler);
    try
    {
        var httpMessage = await client.GetAsync("https://localhost:5001/WeatherForecast");
    }
    catch (Exception e)
    {
        Console.WriteLine(e);
        throw;
    }
}
Run Code Online (Sandbox Code Playgroud)

使用此代码我收到以下错误:

System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.IO.IOException: Cannot determine the frame size or a corrupted frame was received.
Run Code Online (Sandbox Code Playgroud)

之后,我向邮递员尝试了相同的请求,并且成功了(与招摇一样)。我的最终测试是将控制台应用程序切换到 netcore …

c# .net-5

19
推荐指数
3
解决办法
4万
查看次数

c# - ResourceManager 和 ResourceSet 给我空或 null 结果

我目前正在处理资源文件来翻译一些文本。

我有主要的“RevitString.resx”和“RevitString.fr-FR.resx”。它们都具有相同的密钥和翻译值并且是公开的。

我想在我的 C# 代码中使用它们,代码如下:

ResourceSet resourceSet = Resources.Languages.Tables.RevitString.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
type = (from ResourceDictionary x 
        in resourceSet 
        where x.Keys.ToString() == _type.Definition.ParameterGroup.ToString()
        select x.Values.ToString()).FirstOrDefault();
Run Code Online (Sandbox Code Playgroud)

但是当我运行这个程序时,我得到了一个空的 ResourceSet,当我查看 ResourceManager 时,“ResourceSets”为空,计数 = 0。

我做错了什么 ?

我已经看过一些这样的帖子

谢谢你!

c#

6
推荐指数
1
解决办法
2107
查看次数

标签 统计

c# ×2

.net-5 ×1