gpt4 book ai didi

c# - HANA服务层: Could not establish trust relationship for the SSL/TLS secure channel

转载 作者:行者123 更新时间:2023-12-02 19:35:19 25 4
gpt4 key购买 nike

我试图通过我的代码调用 SAP HANA 服务层,但我偶然发现了以下错误:所以任何人都可以帮助我解决这个问题。

第一个错误:

AuthenticationException: The remote certificate is invalid according to the validation procedure.

第二个错误:

WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

第三个错误:

HttpRequestException: An error occurred while sending the request.

有关应用程序的更多详细信息 - 我在 .NET 中创建了控制台应用程序,它在服务器上执行 [HANA 服务器是本地访问的,因为两台服务器都在 LAN 中] Linux 和 Windows服务器。

还有一件事 - 我的客户不打算购买 SAP HANA 服务层的域名和 SSL 证书,因为它将由我的应用程序在内部使用。

问题是,当我通过 Postman 测试登录服务时,它工作正常,我也获得了 session 详细信息,但相同的 URL 无法通过我的代码工作,所以我还需要做些什么来访问该服务?

网址 - https://172.17.100.35:50000/b1s/v1/Login

using (var client = new HttpClient())
{
var credentials = new { UserName = "admin", Password = "", "" };
var json = JsonConvert.SerializeObject(credentials);

var response = client.PostAsync(url),
new StringContent(json, Encoding.UTF8, "application/json")).Result;

if (response.IsSuccessStatusCode)
{
dynamic content = JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result);

// Access variables from the returned JSON object
var appHref = content.links.applications.href;
}
}

最佳答案

如果将来的 Google 员工在将请求发送到登录端点后收到 500 错误响应,请禁用 ExpectContinue。

client.DefaultRequestHeaders.ExpectContinue = false;

关于c# - HANA服务层: Could not establish trust relationship for the SSL/TLS secure channel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45370795/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com