Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php SqlException故障排除(0x80131904)_Php_Sql_Sql Server - Fatal编程技术网

Php SqlException故障排除(0x80131904)

Php SqlException故障排除(0x80131904),php,sql,sql-server,Php,Sql,Sql Server,我已经尝试解决这个错误一段时间了,但没有成功。我想知道是否有人可以帮助我开始识别可能导致此错误的原因 我尝试查看调用它的php脚本,但没有帮助。此外,我无法找到此路径: Inventory1.welcome.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\Inventory1\welcome.aspx.cs:55 完整错误消息 [SqlException (0x80131904): A network-related or

我已经尝试解决这个错误一段时间了,但没有成功。我想知道是否有人可以帮助我开始识别可能导致此错误的原因

我尝试查看调用它的php脚本,但没有帮助。此外,我无法找到此路径:

Inventory1.welcome.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\Inventory1\welcome.aspx.cs:55
完整错误消息

[SqlException (0x80131904): 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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6256377
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245
   System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +6270399
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +181
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +6271242
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6271208
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +354
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +703
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +54
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6272472
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +81
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1657
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +88
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6275911
   System.Data.SqlClient.SqlConnection.Open() +258
   Inventory1.welcome.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\Inventory1\welcome.aspx.cs:55
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428

非常感谢

这是一个
SqlException

运行时发生与网络相关或特定于实例的错误 正在建立与SQL Server的连接。找不到服务器,或者 无法访问。验证实例名称是否正确,以及 SQL Server配置为允许远程连接。(提供者:已命名) 管道提供程序,错误:40-无法打开到SQL Server的连接)

Page\u加载
Welcome.aspx
Page的代码隐藏文件的方法试图打开与sql server的连接,但失败。检查您的连接字符串

基本上,在打开SqlConnection对象以查询数据库之前,您应该为它提供一个
有效的连接字符串。前

using(SqlConnection cnn = new SqlConnection("valid_connection_string"))
{
   //Other stuff
   cnn.Open();
   //Execute the command
}

具有各种不同类型的连接字符串。

下面是关于Sql连接调试的完整报告的URL

您的问题可能像错误的密码一样简单

可能是Sql Server不允许远程连接


谢谢您的回复。所描述的错误消息的奇怪之处在于
C:\Inetpub\wwwroot\Inventory1\welcome.aspx.cs:55
是服务器上不再存在的路径。我新建了
welcome.aspx
路径,似乎sql正在尝试访问一个过时的路径。因此,我无法访问
C:\Inetpub\wwwroot\Inventory1\welcome.aspx.cs:55
您是在IIS还是Asp.net服务器上运行该站点?错误路径似乎来自IIS根文件夹。另一个选项。有时,编译代码的路径(在dll中)会出现错误。比如,我们的“构建机器”构建了我们所有的代码……每当文件路径出现异常时,它就会显示构建机器的文件夹结构。我不认为这里是这种情况,但考虑到另一种可能性。为了隔离错误,您可以设置一个调试点,尝试打开()连接并检查ConnectionString是否正常。