.NET 8 - ElasticsearchClientException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call

Hello.
We upgrade our application to .net 8, and and we also upgrade the latest NEST library: version:

<PackageReference Include="NEST" Version="7.17.5" />
<PackageReference Include="NEST.JsonNetSerializer" Version="7.17.5" />

If i run my application in localhost, should connect to elastic server correctly.
But when we deploy the application to azure, we got an exception:

Full trace:

2023-12-31T15:43:47Z   [Information]   [15:43:46 INF] Start GetElasticDocumentQuery handling
2023-12-31T15:43:47Z   [Information]   [15:43:46 INF] elasticSetting: http://ip_addr:9201/
2023-12-31T15:43:47Z   [Information]   [15:43:46 INF] Search success: Invalid NEST response built from a unsuccessful () low level call on POST: /test-index/_search?typed_keys=true
2023-12-31T15:43:47Z   [Information]   # Audit trail of this API call:
2023-12-31T15:43:47Z   [Information]    - [1] ProductCheckOnStartup: Took: 00:00:00.0018850
2023-12-31T15:43:47Z   [Information]    - [2] ProductCheckFailure: Node: http://ip_addr:9201/ Took: 00:00:00.0018489
2023-12-31T15:43:47Z   [Information]   # OriginalException: Elasticsearch.Net.ElasticsearchClientException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product. Call: Status code unknown from: GET /
2023-12-31T15:43:47Z   [Information]    ---> Elasticsearch.Net.PipelineException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product.
2023-12-31T15:43:47Z   [Information]    ---> System.Net.Http.HttpRequestException: An attempt was made to access a socket in a way forbidden by its access permissions. (ip_addr:9201)
2023-12-31T15:43:47Z   [Information]    ---> System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions.
2023-12-31T15:43:47Z   [Information]      at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
2023-12-31T15:43:47Z   [Information]      at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      --- End of inner exception stack trace ---
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
2023-12-31T15:43:47Z   [Information]      at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.HttpConnection.RequestAsync[TResponse](RequestData requestData, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      --- End of inner exception stack trace ---
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.RequestPipeline.ThrowIfTransientProductCheckFailure()
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.RequestPipeline.PingAsync(Node node, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.Transport`1.PingAsync(IRequestPipeline pipeline, Node node, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.Transport`1.RequestAsync[TResponse](HttpMethod method, String path, CancellationToken cancellationToken, PostData data, IRequestParameters requestParameters)
2023-12-31T15:43:47Z   [Information]      --- End of inner exception stack trace ---
2023-12-31T15:43:47Z   [Information]   # Request:
2023-12-31T15:43:47Z   [Information]   <Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
2023-12-31T15:43:47Z   [Information]   # Response:
2023-12-31T15:43:47Z   [Information]   <Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
2023-12-31T15:43:47Z   [Information]   [15:43:46 INF] Search success: Invalid NEST response built from a unsuccessful () low level call on POST: /prosharp-gdsn-prod-nl%2A/_search?typed_keys=true
2023-12-31T15:43:47Z   [Information]   # Audit trail of this API call:
2023-12-31T15:43:47Z   [Information]    - [1] ProductCheckOnStartup: Took: 00:00:00.0011674
2023-12-31T15:43:47Z   [Information]    - [2] ProductCheckFailure: Node: http://ip_addr:9201/ Took: 00:00:00.0011433
2023-12-31T15:43:47Z   [Information]   # OriginalException: Elasticsearch.Net.ElasticsearchClientException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product. Call: Status code unknown from: GET /
2023-12-31T15:43:47Z   [Information]    ---> Elasticsearch.Net.PipelineException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product.
2023-12-31T15:43:47Z   [Information]    ---> System.Net.Http.HttpRequestException: An attempt was made to access a socket in a way forbidden by its access permissions. (10.100.0.71:9201)
2023-12-31T15:43:47Z   [Information]    ---> System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions.
2023-12-31T15:43:47Z   [Information]      at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
2023-12-31T15:43:47Z   [Information]      at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      --- End of inner exception stack trace ---
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
2023-12-31T15:43:47Z   [Information]      at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.HttpConnection.RequestAsync[TResponse](RequestData requestData, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      --- End of inner exception stack trace ---
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.RequestPipeline.ThrowIfTransientProductCheckFailure()
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.RequestPipeline.PingAsync(Node node, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.Transport`1.PingAsync(IRequestPipeline pipeline, Node node, CancellationToken cancellationToken)
2023-12-31T15:43:47Z   [Information]      at Elasticsearch.Net.Transport`1.RequestAsync[TResponse](HttpMethod method, String path, CancellationToken cancellationToken, PostData data, IRequestParameters requestParameters)
2023-12-31T15:43:47Z   [Information]      --- End of inner exception stack trace ---
2023-12-31T15:43:47Z   [Information]   # Request:
2023-12-31T15:43:47Z   [Information]   <Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
2023-12-31T15:43:47Z   [Information]   # Response:
2023-12-31T15:43:47Z   [Information]   <Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>

The elastic cluster is running under docker env:

{
  "name": "21c8ec38fd8e",
  "cluster_name": "docker-cluster",
  "cluster_uuid": "...",
  "version": {
    "number": "7.9.2",
    "build_flavor": "default",
    "build_type": "docker",
    "build_hash": "...",
    "build_date": "2020-09-23T00:45:33.626720Z",
    "build_snapshot": false,
    "lucene_version": "8.6.2",
    "minimum_wire_compatibility_version": "6.8.0",
    "minimum_index_compatibility_version": "6.0.0-beta1"
  },
  "tagline": "You Know, for Search"
}

all worked with the previous version of the application.

NEST connection factory:

var elasticSetting = ElasticSearchSettingProvider.GetSetting(environment);

var pool = new SingleNodeConnectionPool(new Uri(elasticSetting.Url));

var settings = new ConnectionSettings(
        pool,
        sourceSerializer: (builtin, settings) => new JsonNetSerializer(builtin, settings))
    .DefaultFieldNameInferrer(p => p)
    .DefaultIndex(elasticSetting.IndexName)
    .BasicAuthentication(elasticSetting.UserName, elasticSetting.Password);
settings.EnableApiVersioningHeader();

var client = new ElasticClient(settings);

the server can only be accessed via an internal network, so we don't use HTTPS or domain resolution, we can access the server via IP, protected by basic authentication
what could be the problem ?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.