做ASP.NET項目,出現這個是什麼意思?怎麼解決?
是因為IIS沒有配置好還是因為別的呢?「/」應用程序中的伺服器錯誤。找不到網路路徑。 說明: 執行當前 Web 請求期間,出現未經處理的異常。請檢查堆棧跟蹤信息,以了解有關該錯誤以及代碼中導致錯誤的出處的詳細信息。異常詳細信息: System.ComponentModel.Win32Exception: 找不到網路路徑。
源錯誤:源文件: e:http://ASP.NET項目TM 4LibraryMSApp_CodeDataBase.cs 行: 38
行 36: }
行 37: if (con.State == System.Data.ConnectionState.Closed)
行 38: con.Open();
行 39: }
行 40: #endregion堆棧跟蹤:
[Win32Exception (0x80004005): 找不到網路路徑。]
[SqlException (0x80131904): 在與 SQL Server 建立連接時出現與網路相關的或特定於實例的錯誤。未找到或無法訪問伺服器。請驗證實例名稱是否正確並且 SQL Server 已配置為允許遠程連接。 (provider: Named Pipes Provider, error: 40 - 無法打開到 SQL Server 的連接)]
版本信息: Microsoft .NET Framework 版本:4.0.30319; http://ASP.NET 版本:4.0.30319.34212
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5340655
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5350915
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +891
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +518
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +278
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +732
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +85
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal connection) +1057
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal connection) +78
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal connection) +196
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +146
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +16
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +94
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +110
System.Data.SqlClient.SqlConnection.Open() +96
DataBase.Open() in e:ASP.NET項目TM 4LibraryMSApp_CodeDataBase.cs:38
DataBase.CreateDataAdaper(String procName, SqlParameter[] prams) in e:ASP.NET項目TM 4LibraryMSApp_CodeDataBase.cs:181
DataBase.RunProcReturn(String procName, String tbName) in e:ASP.NET項目TM 4LibraryMSApp_CodeDataBase.cs:162
BookManage.GetBookSort(String tbName) in e:ASP.NET項目TM 4LibraryMSApp_CodeBookManage.cs:323
_Default.Page_Load(Object sender, EventArgs e) in e:ASP.NET項目TM 4LibraryMSDefault.aspx.cs:19
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
這就是連接資料庫出錯而導致的錯誤。
比如連接字元串錯誤,或者指定的資料庫服務不可用。檢查你的資料庫連接字元串是不是正確
檢查你的資料庫服務是不是在運行資料庫連接字元串在每個項目里存儲位置不盡相同。 通常位於項目根目錄的 Web.Config 的 connectionStrings 配置節中(也有人寫在 appSettings 節中,或者存在 App_Data 文件夾的某個文件里)。
你看到這個界面,而且運行的確實是你的代碼(從堆棧里看到源文件路徑),就說明 IIS 配置沒問題(如果你配置到了 IIS 上)。能這麼詳細的提供錯誤信息,也是非常有心了,但我覺著可以自己動動手呀,去搜索下關鍵字就能找到答案的:
在與 SQL Server 建立連接時出現與網路相關的或特定於實例的錯誤。未找到或無法訪問伺服器。請驗證實例名稱是否正確並且 SQL Server 已配置為允許遠程連接。 (provider: Named Pipes Provider, error: 40 - 無法打開到 SQL Server 的連接)