简体   繁体   English

SAP Hana服务层:无法为SSL / TLS安全通道建立信任关系

[英]SAP Hana Service Layer : Could not establish trust relationship for the SSL/TLS secure channel

I am trying to call SAP Hana Service Layer through my code but I am stumbling upon the below error : So can anyone please help me on this. 我正在尝试通过我的代码调用SAP Hana服务层,但是我遇到了以下错误:所以有人可以帮我这个忙。

Error 1st : AuthenticationException: The remote certificate is invalid according to the validation procedure. 错误1st: AuthenticationException:根据验证过程,远程证书无效。

Error 2nd : WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. 错误2nd: WebException:基础连接已关闭:无法建立SSL / TLS安全通道的信任关系。

Error 3rd : HttpRequestException: An error occurred while sending the request. 错误3rd: HttpRequestException:发送请求时发生错误。

Some more details about the App - I have created the console app in .net & its execute on the server [Hana Server is locally accessed as both the server are in the LAN] Linux & Windows Server. 有关该应用程序的更多详细信息 -我已经在.net中创建了控制台应用程序,并且在服务器上执行了该应用程序[Hana Server可以在本地访问,因为这两个服务器都位于LAN中] Linux&Windows Server。

One more thing - My client is not planning to purchase the domain name & SSL certificate for the SAP Hana Service Layer because it will be consumed by my app internally. 还有一件事 -我的客户不打算购买SAP Hana服务层的域名和SSL证书,因为它将由我的应用内部使用。

The thing is, When I tested the login service via Postman its working fine & I am getting the session details as well but the same url is not working through my code so is there anything more I need to do to access the service ? 问题是,当我通过Postman测试登录服务时,它的工作正常,并且我也获得了会话详细信息,但是相同的url在我的代码中不起作用,因此,我需要做更多的事情才能访问该服务吗?

URL - https://172.17.100.35:50000/b1s/v1/Login 网址-https: //172.17.100.35: 50000/ b1s/ v1/ 登录

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;
}
}

You need to put this code before postAsync 您需要将此代码放在postAsync之前

 ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; 

This avoid the validation of the certificate. 这样可以避免证书的验证。

对于将来的Google员工,在将您的请求发送到Login端点后收到500错误响应,请禁用ExpectContinue。

client.DefaultRequestHeaders.ExpectContinue = false;

If you are using self signed certificates you have to accepted them first. 如果您使用的是自签名证书,则必须先接受它们。 that can be done by add it to windows certificates ou by the browser! 可以通过浏览器将其添加到Windows证书ou中来完成! if you are making cross-domain calls, you need to change the b1s.config 如果进行跨域调用,则需要更改b1s.config

vim /usr/sap/SAPBusinessOne/ServiceLayer/conf/b1s.conf

(...)
"CorsEnable": true,
 "CorsAllowedOrigins": "*"}

do note use * in production MODE <-<<<-- 请注意在生产模式中使用* <-<<<-

暂无
暂无

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

相关问题 WCF:无法为具有权限的SSL / TLS安全通道建立信任关系 - WCF: Could not establish trust relationship for the SSL/TLS secure channel with authority WebException无法为SSL / TLS安全通道建立信任关系 - WebException Could not establish trust relationship for the SSL/TLS secure channel 错误:无法通过授权为SSL / TLS安全通道建立信任关系 - Error: Could not establish trust relationship for the SSL/TLS secure channel with authority 无法为 SSL/TLS 安全通道建立信任关系 -- SOAP - Could not establish trust relationship for SSL/TLS secure channel -- SOAP 随机抛出“无法建立SSL / TLS安全通道的信任关系” - Randomly throwing “Could not establish trust relationship for the SSL/TLS secure channel” 无法建立SSL / TLS安全通道的信任关系 - Could not establish trust relationship for the SSL/TLS secure channel C#Web服务-无法使用授权“ noded1.test.webservices.amadeus.com”为SSL / TLS安全通道建立信任关系 - C# Web service - Could not establish trust relationship for the SSL/TLS secure channel with authority 'noded1.test.webservices.amadeus.com' C#客户端到SoapUI https模拟服务:无法为具有权限“ localhost:8083”的SSL / TLS安全通道建立信任关系 - C# client to SoapUI https mock service: Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost:8083' SSL WCF“无法与权限&#39;localhost&#39;建立SSL / TLS安全通道的信任关系 - SSL WCF "Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost' asp.net core 2.0 中的 WCF - 无法为具有权限的 SSL/TLS 安全通道建立信任关系 - WCF in asp.net core 2.0 - Could not establish trust relationship for the SSL/TLS secure channel with authority
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM