Trying to connect to Sphinx Windows Service - c#

I trying to connect to Sphinx Windows Service localhost. I have installed the service and it is running, I have built an index correctly and I am using a .net Sphinx Client to try and connect: https://code.google.com/p/sphinx-dotnet-client/
ConnectionBase _connection;
_connection = new PersistentTcpConnection("localhost", 9312);
try
{
_connection.Open();
var command = new SearchCommand(_connection, new SearchQuery("garcia"));
command.Execute();
}
finally
{
_connection.Close();
}
I am getting the error:
"An existing connection was forcibly closed by the remote host"
This is the default port for Sphinx according to there documentation:
http://sphinxsearch.com/docs/current.html#quick-tour
I am at a loss on how to debug this and what step to take next.

Related

UWP C# SQL Server Connection local network 'Cannot connect to SQL Server Browser. Ensure SQL Server Browser has been started.'

Using UWP C# trying to connect to a server on the same network I keep getting an error:
System.Exception: 'Cannot connect to SQL Server Browser. Ensure SQL
Server Browser has been started.'
Inner Exception SocketException: An existing connection was
forcibly closed by the remote host
Trouble Shooting Steps
I've Made sure that the TCP in enabled
Created a port rule 1433
I've made sure that SQl server browser is running on the server
Tried connection string with both IP and Computer Name
the string I'm using is:
#"Data Source=.\SERVER-DEV\MSSQLSERVER01;Initial Catalog=**********;User ID=Reece;Password=**********;";
It connects to the database I just don't understand why it's then giving this error,
I'm using the System.Data.SqlClient;
the error is flagged on conn.open();.
using (SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
if (conn.State == System.Data.ConnectionState.Open)
{
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = exacutionString;
cmd.ExecuteReader();
}
}
}

Connecting to AWS RDS via C#

I am trying to connect to MySQL AWS RDS using following simple C# code.
string cs = #"server=swift-test.czjkayncnfz9.us-east-2.rds.amazonaws.com;port=3306;userid=*****;password=*****;database=swift-db";
var con = new MySqlConnection(cs);
con.Open();
But I get the following exception
"Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time
, or established connection failed because connected host has failed to respond."
The screenshots of my Inbound & Outbound rules are attached.
Do you have any EC2 instance in this setup?
If yes, then try referencing that security group in your inbound rules with the type as MySql/Aurora.

:'Unable to connect to any of the specified MySQL hosts.' error

I want to connect to a MySQl db using a connection string but unable to connect
I'm using UWP and using The fall creator version for both target and min version
I've installed the Nuget packages for Mysql connector
I've tried to change the string with and without port,ect.
public string GetMatchCode()
{
string connectString = "Server=###.###.###.###;Database=Db;Uid=root;Pwd=123;sslmode=none;port=3306";
string sql = "SELECT * FROM `customer`";
using (var connect = new MySqlConnection(connectString))
using (var command = new MySqlCommand(sql, connect))
{
connect.Open();
return command.ExecuteScalar().ToString();
}
}
MySql.Data.MySqlClient.MySqlException: 'Unable to connect to any of the specified MySQL hosts.'
MySqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The error starts at connect.Open();
I've tested the connection with workbench to make sure it's working.
I've looked through most similar post but none have worked for me.
There could many possible scenario's where connection will fail.
Please see below points to troubleshoot your error.
Check your Windows Firewall to ensure that server has an access to Port's associated with your MySql.
Disconnect and re-connect your VPN client.
Follow standard Spacing and Order of parameters in connection string. Follow below format to build/form connection string.
Server=ServerAddress; Port=4563; Database=DataBaseName; Uid=UserName;
Pwd=Password;
Consider using Connection Pulling, So existing connection will be reused.

MySQL Connection from an IoT Edge Module

I use my machine as a simulated device.
I deployed a docker image as a module to the device where I want to connect to a MySQL instance.
But I have the following error:
Unable to connect to any of the specified MySQL hosts.
I build the connection like this:
public static MySqlConnection BuildConnection(MySqlProperties parameters)
{
MySqlConnectionStringBuilder connString = new MySqlConnectionStringBuilder();
connString.Server = parameters.Server;
connString.Database = parameters.Database;
connString.UserID = parameters.Username;
connString.Password = parameters.Password;
connString.Add("Allow User Variables", true);
var connection = new MySqlConnection(connString.ToString());
return connection;
}
and then execute
var conn = BuildConnection(props);
Console.WriteLine("opening connection to mysql ...");
conn.Open();
Console.WriteLine("Connection state: " + conn.State);
Is it possible to connect to that database ?
The issue was that MySQL wasn't configured for remote connections.
I'm about to get deep in this topic. As far as my understandings are, this error is expected, because you have to install the MySQL server as a module on the Edge run-time.
This Microsoft documentation provides instructions on storing data on the Edge with SQL Server. It is written that the same should work for MySQL, as well.

RabbitMQ : System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

I have to connect RabbitMQ Server from localhost. Application is built in c#.
I did following settings for connect RabbitMQ
var cf = new ConnectionFactory();
cf.Uri = new Uri("amqps://user:pass#172.20.0.72:5671/vhost");
cf.Ssl.Enabled = true;
cf.Ssl.ServerName = System.Net.Dns.GetHostName();
cf.Ssl.CertPath = #"D:\Vishal_Yagnik\DeskTop_25092018\Certi\test.p12";
cf.Ssl.CertPassphrase = "test";
var connection = cf.CreateConnection();
But I am getting following error.
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
Is that possible to connect RabbitMQ server from localhost. Also install cert file in local machine.

Categories

Resources