0
我正在开发ASP.net,目前正在使用NEST插件。我有一个实体框架数据的基础模型和弹性搜索似乎无法建立连接:NEST with ElasticSearch System.net.WebException
Uri uri = new Uri("http://localhost:52009");
ConnectionSettings elasticSettings = new ConnectionSettings(uri);
ElasticClient client = new ElasticClient(elasticSettings);
ConnectionStatus connectionStatus;
Debug.WriteLine(client.TryConnect(out connectionStatus)); // prints FALSE
elasticSettings.SetDefaultIndex("name");
我相信这是由于错误的连接设置,因为这在我的调试器打印出:
第一在System.dll中发生类型'System.Net.WebException'的偶然异常 Newtonsoft.Json.dll中发生第一次机会异常类型'Newtonsoft.Json.JsonReaderException'
但我不会再有错误除此之外的细节。
但我知道该弹性搜索不起作用,因为每当我尝试为ElasticSearch建立连接时,都会收到System.Net.WebException。我也将端口更改为9200,结果相同。 –
您是否在浏览器中浏览网址时得到“ok”的结果:true。否则,ElasticSearch服务可能当前未运行。 –