i have signup into elastic cloud and created account and perform crude opetion into c# project that working fine into local pc but it getting stop working when i deploy this code into online or iis.
i am using elastic loud url and credential to perform all task.
My sample code into my C# Project
var uri = new Uri("https://elastic:password@cloud elastic url");
var settings = new ConnectionSettings(uri).DisableDirectStreaming();
var client = new ElasticClient(settings);
var response1 = client.ClusterHealth();
if (response1.DebugInformation != null)
_logger.Error(response1.DebugInformation );
Full error message display as below:-
Invalid NEST response built from a unsuccessful low level call on GET: /_cluster/health
Audit trail of this API call:
- [1] BadRequest: Node: https://elastic:password@url/ Took: 00:00:00.0553689
OriginalException: System.Net.Http.HttpRequestException: An attempt was made to access a socket in a way forbidden by its access permissions ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask
1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask) at System.Threading.Tasks.ValueTask
1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Elasticsearch.Net.HttpConnection.Request[TResponse](RequestData requestData)
Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>