简体   繁体   English

无法远程访问sql server(错误消息:远程系统拒绝了网络连接)

[英]unable to access sql server remotely (error says :the remote system refused the network connection)

I tried using windows authentication but the server I'm using is also an active directory server so I'm using sql authentication instead. 我尝试使用Windows身份验证,但我使用的服务器也是活动目录服务器,因此我改用sql身份验证。

public const string con = "Data source=192.168.56.101,1433" + ";" +"Database=" +
    database + ";" + "User ID=" + user + ";" + "password=" + password;

this is the connection string 这是连接字符串

Also I carefully configured and reconfigured Sqlserver to allow remote connections and completely turned the firewall off 另外,我还仔细配置和重新配置了Sqlserver以允许远程连接,并完全关闭了防火墙

Make sure that TCP/IP is enabled in SQL Server. 确保在SQL Server中启用了TCP / IP。 You can find that setting in the Sql Server Configuration Manager, under the Sql Server Network Configuration. 您可以在Sql Server网络配置下的Sql Server配置管理器中找到该设置。 Once it's enabled, under the properties of the TCP/IP configuration, in the IP Addresses tab, make sure your IP is active and note the port (1433 is the default). 启用后,请在“ TCP / IP”配置的属性下的“ IP地址”选项卡中,确保您的IP是活动的,并记下该端口(默认值为1433)。

Open the TCP port (1433 is the default) in the firewall. 在防火墙中打开TCP端口(默认值为1433)。 Also make sure that your connection string follows a connection string that is understood by the provider. 还要确保您的连接字符串遵循提供程序可以理解的连接字符串。 For SQL Server one can be: 对于SQL Server,可以是:

Server=myServerAddress;Database=myDataBase;User Id=myUsername; Server = myServerAddress;数据库= myDataBase;用户ID = myUsername; Password=myPassword; 密码= MYPASSWORD;

refer to connectionstrings.com for more details 有关更多详细信息,请参考connectionstrings.com

我解决了这个问题,因为我怀疑端口1433并非TCP连接的默认端口,因为服务器位于虚拟机上,解决方案是将SQL Server管理TCP协议的配置重置为使用动态端口并侦听所有,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows FTP连接显示无法连接到远程服务器 - Windows FTP Connection says Unable to connect to the remote server 与远程服务器的SQL连接错误 - SQL Connection Error to Remote Server 无法连接到远程服务器:由于目标计算机主动拒绝连接,因此无法建立连接 - Unable to connect to the remote server: No connection could be made because the target machine actively refused it 无法连接到远程服务器 ---> 无法建立连接,因为目标机器主动拒绝它 - Unable to connect to the remote server ---> No connection could be made because the target machine actively refused it 编写连接字符串以访问远程SQL Server数据库 - Writing a connection string to access a remote SQL Server database SQL 服务器连接客户端到服务器时远程连接出错 - Error in remote connection in SQL Server when connecting the client to the server 无法连接到VS2012中的localDB - “建立与SQL Server的连接时发生与网络相关或特定于实例的错误...” - Unable to connect to localDB in VS2012 – “A network-related or instance-specific error occurred while establishing a connection to SQL Server…” SQL Server连接到网络中的数据库 - SQL Server connection to db in network 远程计算机登录上SQL Server Express的连接字符串失败错误 - Connection string for SQL Server Express on remote Computer login failed error 远程SQL Server连接字符串 - Remote SQL Server connection string
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM