0

しばらくの間、このエラーのトラブルシューティングを試みましたが、成功しませんでした。誰かがこのエラーの原因を特定し始めるのを手伝ってくれるのではないかと思っていました.

それを呼び出している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

よろしくお願いします!

4

2 に答える 2

0

これはSqlException.

SQL Server への接続を確立中に、ネットワーク関連またはインスタンス固有のエラーが発生しました。サーバーが見つからないか、アクセスできませんでした。インスタンス名が正しいこと、および SQL Server がリモート接続を許可するように構成されていることを確認してください。(プロバイダー: 名前付きパイプ プロバイダー、エラー: 40 - SQL Server への接続を開けませんでした)

Page_Loadページのコード ビハインド ファイルのメソッドが、Welcome.aspxSQL サーバーへの接続を開こうとして失敗しています。接続文字列を確認してください。

基本的にvalid connection string、データベースを照会するために開く前に、 SqlConnection オブジェクトに を指定する必要があります。元;

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

この Web サイトには、さまざまな種類の接続文字列があります。

于 2013-02-25T14:57:19.737 に答える
0

以下は、SQL 接続のデバッグに関する完全な記事の URL です。

あなたの問題は、誤ったパスワードと同じくらい単純である可能性があります.

また

Sql Server がリモート接続を許可していない可能性があります。

http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx

于 2013-02-25T15:06:09.320 に答える