首页 > 解决方案 > Blazor 错误:无法建立 SSL 连接,请参阅内部异常

问题描述

您好,我尝试在 SAP 中使用 api 进行测试,我有这段代码,我使用 .net core 5 和 Blazor

private async Task<bool> ValidateUser()
{
    try
    {
        _login.CompanyDB = "VISUALK_CL";

        string serializedUser = JsonConvert.SerializeObject(_login);

        HttpRequestMessage httpRequestMessage = new HttpRequestMessage();

        httpRequestMessage.Method = new HttpMethod("POST");
        httpRequestMessage.RequestUri = new Uri("https://office.visualk.cl:50346//b1s/v1/Login");
        httpRequestMessage.Content = new StringContent(serializedUser);


        httpRequestMessage.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

        var response = await Http.SendAsync(httpRequestMessage);
        var responseStatusCode = response.StatusCode;
        var responseBody = await response.Content.ReadAsStringAsync();


        if (responseStatusCode.ToString() == "OK")
        {
            var returnedUser = JsonConvert.DeserializeObject<Login>(responseBody);
            NavManager.NavigateTo("/", forceLoad: true);
        }
        else
        {

        }

        return await Task.FromResult(true);
    }
    catch (Exception ex)
    {
        NavManager.NavigateTo("/LogPostulaciones", forceLoad: true);
        throw;
    }
}

但是什么时候去排队

var response = 等待 Http.SendAsync(httpRequestMessage);

INNER EX : 根据验证程序,远程证书无效:RemoteCertificateNameMismatch, RemoteCertificateChainErrors

我收到错误

为所有人

标签: .netsslblazor

解决方案


好的,当我在 Firefox 中删除该 URL 时,我得到

安全连接失败

连接到office.visualk.cl:50346时出错。对等体使用不受支持的安全协议版本。

错误代码:SSL_ERROR_UNSUPPORTED_VERSION

The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the web site owners to inform them of this problem.

了解更多...</p>

此网站可能不支持 TLS 1.2 协议,这是 Firefox 支持的最低版本。启用 TLS 1.0 和 TLS 1.1 可能会允许此连接成功。

TLS 1.0 和 TLS 1.1 将在未来版本中永久禁用。

Chrome 只是显示一个错误,没有更多信息。

此规则由浏览器而非 Blazor 强制执行。

您可能会使用 Firefox 的提议通过启用 TLS 1.1 来降低安全性,但最好的方法是联系office.visualk.cl的所有者/运营商并告诉他们他们的软件已过期。


推荐阅读