且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

建立与SQL Server的连接时发生网络相关或实例特定的错误

更新时间:2023-02-03 07:53:50

当您的应用程序没有足够的权限访问数据库时,Sql Server会触发此错误。有几个原因关于这个错误。要解决这个错误,你应该遵循以下指令。

Sql Server fire this error when your application don't have enough rights to access the database. there are several reason about this error . To fix this error you should follow the following instruction.


  1. 尝试使用管理工作室从服务器连接sql服务器。如果使用Windows身份验证连接sql服务器,然后将您的应用程序池标识设置为服务器管理员。

  1. Try to connect sql server from your server using management studio . if you use windows authentication to connect sql server then set your application pool identity to server administrator .

如果使用sql server身份验证,请检查Web应用程序的web.config中的连接字符串,并设置sql server的用户ID和密码,登录 。

if you use sql server authentication then check you connection string in web.config of your web application and set user id and password of sql server which allows you to log in .

如果您的数据库在其他服务器(访问远程数据库),则首先启用远程访问sql server从sql server管理工作室形成sql server属性并启用TCP / IP表单sql server配置管理器。

if your database in other server(access remote database) then first of enable remote access of sql server form sql server property from sql server management studio and enable TCP/IP form sql server configuration manager .

之后,您仍然无法访问数据库,然后检查您尝试访问数据库的服务器表单的防火墙,并添加一个规则在防火墙中启用sql server的端口(默认情况下sql server使用1433,要检查sql server的端口,需要检查sql server配置管理器的网络协议TCP / IP端口)。

after doing all these stuff and you still can't access the database then check firewall of server form where you are trying to access the database and add one rule in firewall to enable port of sql server(by default sql server use 1433 , to check port of sql server you need to check sql server configuration manager network protocol TCP/IP port).

如果您的sql服务器在命名实例上运行,则需要使用sql serer名称写端口号,例如117.312.21.21/nameofsqlserver1433.

if your sql server is running on named instance then you need to write port number with sql serer name for example 117.312.21.21/nameofsqlserver,1433.

如果您使用云端主机(例如amazon aws或microsoft azure),伺服器或执行个体将会在云端防火墙之后运行,因此您必须启用云端防火墙中的1433端口sql server的命名实例的默认实例或特定端口。

If you are using cloud hosting like amazon aws or microsoft azure then server or instance will running behind cloud firewall so you need to enable 1433 port in cloud firewall if you have default instance or specific port for sql server for named instance.

如果您使用的是亚马逊RDS或SQL Azure,那么您需要启用该实例的安全组端口。

If you are using amazon RDS or SQL azure then you need to enable port from security group of that instance.

如果您通过sql server身份验证模式访问sql server,他们确保启用了SQL Server和Windows身份验证模式sql server实例属性。

If you are accessing sql server through sql server authentication mode them make sure you enabled "SQL Server and Windows Authentication Mode" sql server instance property.


  1. 在进行任何操作后重新启动您的sql服务器实例


困难,那么你需要提供更多关于你的网站和sql服务器的信息。

if you further face any difficulty then you need to provide more information about your web site and sql server .