I am using following code to make an http call to external service provider lokalise.
var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-token", _config.GetSection("Localize:ApiToken").Value);
var response = await client.GetAsync(_config.GetSection("Localize:ApiUrl").Value);
var localizeResponse = JsonConvert.DeserializeObject<LocalizeResponse>(await response.Content.ReadAsStringAsync());
but I am getting following exception
System.Net.Http.HttpRequestException: Name or service not known\n ---> System.Net.Sockets.SocketException (0xFFFDFFFF): Name or service not known\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\n --- End of inner exception stack trace ---\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)\n at System.Net.Http.RedirectHandler.SendAsync(H...
Any suggestion what could be the issue, Do I need some kind of proxyfier to make an http call from OCP hosted container? If so then how? any other suggestions?
In general there should not be any limitations from OpenShift side to issue HTTP calls to external services / API by default. If you are a user of an OpenShift service then the following things could be a blocker:
Also on your own OpenShift server the following problems can cause connection issues:
I hope this helps you. Let me know if I can help further.