连接其他服务器数据库

Connect other server database

我有一个控制台应用程序,想连接其他 windows 服务器,我已经在其中创建了用户、数据库 table。在 conf.xml 我有

<configuration>
  <crypto location="172.16.10.34" database="Crypto_Pan" username="PinbySms" password="ASDasd123"/>
</configuration> 

那么我的代码是:

Dictionary<string, string> d = conf.getCrypto();

SqlConnectionStringBuilder bu = new SqlConnectionStringBuilder();

bu.DataSource = d["location"];
bu.NetworkLibrary = "DBMSSOCN";
bu.InitialCatalog = d["database"];

bu.IntegratedSecurity = false;
bu.UserID = d["username"];
bu.Password = d["password"];
SqlConnection thisConnection = null;

try
{
    thisConnection = new SqlConnection(bu.ConnectionString);
    thisConnection.Open();
    Console.WriteLine("success connected");
}
catch (Exception e)
{
    Console.WriteLine("exeption: " + e.ToString());

    thisConnection.Close();

}

当我的应用程序尝试连接此数据库时出现错误:

[System.Data.SqlClient.SqlException] = {"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

有人有什么建议吗?

sql 配置协议 MSQSQLSERVER TCP/IP 中没有默认端口,我将其更改为 1433,现在可以了。