admin管理员组文章数量:1129449
I have a pariticalur use case while using a stateless service where I need to hit an APS.NET endpoint of all the other instance from one given instance of my service in Service Fabric. I did attempted this via geting node.IpAddressOrFQDN
of all nodes and making an HTTP call either directly to the port on which service is hosted or calling DNS but HTTP call is failing. Any idea about how achieve this use case ?
Calling exact port and enpoint
FabricClient fabricClient = new FabricClient();
NodeList nodes = await fabricClient.QueryManager.GetNodeListAsync();
foreach (Node node in nodes)
{
var nodeIpAddr = node.IpAddressOrFQDN;
string httpAddress = $"http://{nodeIpAddr}:<port>/api/endpoint";
string httpsAddress = $"https://{nodeIpAddr}:<port>/api/endpoint";
HttpClient client = new HttpClient();
var responseA = await client.GetAsync(httpsAddress);
var responseB = await client.GetAsync(httpAddress);
}
return Ok();
Calling DNS
FabricClient fabricClient = new FabricClient();
NodeList nodes = await fabricClient.QueryManager.GetNodeListAsync();
foreach (Node node in nodes)
{
var nodeIpAddr = node.IpAddressOrFQDN;
string httpAddress = $"http://{nodeIpAddr}:19081/Service/Application/api/endpoint";
string httpsAddress = $"https://{nodeIpAddr}:19081/Service/Application/api/endpoint";
HttpClient client = new HttpClient();
var responseA = await client.GetAsync(httpsAddress);
var responseB = await client.GetAsync(httpAddress);
}
return Ok();
Exception in HTTPS call
Error: The SSL connection could not be established, see inner exception. The SSL connection could not be established, see inner exception. at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
HTTP Call response
StatusCode: 404, ReasonPhrase: 'FABRIC_E_ENDPOINT_NOT_FOUND', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Server: Microsoft-HTTPAPI/2.0
Date: Wed, 08 Jan 2025 13:45:29 GMT
Content-Length: 0
}
版权声明:本文标题:asp.net web api - How to call endpoints from one node in Service Fabric to all the other nodes - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736715864a1949195.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论