Difficulty with elasticSearch SSL with .Net

I have Two Servers ..One Installed with Elastic Search on Ubuntu(ip address 192.168.0.2) and Other Working as a Webserver IIS having .NET Application ...

I am Able to Access the Elastic Search on Ubuntu using the Web Browser using the Below Method :-

Screenshot from 2017-11-08 20-54-32

Screenshot from 2017-11-08 20-54-43!

my nginx file Contains

server {
    listen 80 default_server;
    server_name _;
    return 301 http://$server_name$request_uri;
}

server {
    listen 443 default_server ssl http2;

    server_name _;


    ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
    ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
    ssl_session_cache shared:SSL:10m;


    location / {
        proxy_pass http://localhost:9200;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

When Trying to Access the same URL Using .Net using the below code:-

using Nest;
using System;

    namespace IDGElasticSearch
    {
        class Program
        {
            static void Main(string[] args)
            {
                var node = new Uri(“https://192.168.0.2”);
                var settings = new ConnectionSettings(node);
                var client = new ElasticClient(settings);
                var response = client.ClusterHealth();
                Console.WriteLine(response.Status);
                Console.Read();
            }
        }
    }

I get No Output.... Pls Guide me a way forward...

It looks like you may have set Elasticsearch up to use a self-signed certificate for TLS on the HTTP layer, based on the screenshot from Ubuntu.

When connecting to the cluster using the .NET client, if the certificate has not been set up to be a trusted Certificate Authority (CA) on the Windows machine, then certificate validation will fail for requests; you should be able to see this by checking response.IsValid and additional information available on response.DebugInformation - check out the troubleshooting section of the docs for more details.

Take a look at the working with certificates section of the docs to see what options you have available for working with self-signed certificates with the client.

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