[英]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.