1 year ago

#387046

test-img

user41475

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();
                }
            }
        }

c#

sql-server

networking

uwp

0 Answers

Your Answer

Accepted video resources