2012-12-06 91 views
0

我從Web應用程序中收到令人沮喪的錯誤。我追趕了兩天。在某些情況下,數據訪問嘗試期間會出現以下錯誤。發生錯誤時,響應於點擊應用頁面上的鏈接。奇怪的是,在運行跟蹤時,您會看到SQL Server正在使用適當的參數調用適當的存儲過程。在其他情況下,數據訪問表現得很好。連接到SQL Server的錯誤

我發現好奇的一件事是應用程序事件日誌警告(下面​​)的線程信息。 模擬:即使啓用了ASP.Net模擬,也設置爲false。當然,這可能只是我不知道我在說什麼。

任何幫助或指導你都可以提供非常感謝。

環境:Windows Server 2008標準,IIS7,.NET 2.x中,SQL Server 2005中

======================= 
= Yellow Screen = 
======================= 


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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 

Source Error: 


Line 3892: 
Line 3893: Sub getRenewalInformation(ByVal EntityID As Integer) 
Line 3894:  BLLParticipant.GetParticipantRenewalInformation(EntityID) 
Line 3895:  BLLParticipant.GetAdditionalInfo(EntityID) 
Line 3896: End Sub 


Source File: M:\VirtualWebs\Intranet\SafeAtHome\Participants.aspx.vb Line: 3894 

Stack Trace: 


[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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)] 
    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 
    SafeAtHome.DAL.Participant.GetParticipantRenewalInformation(Int32 EntityID) in C:\code\web\SafeAtHome2011\SafeAtHome.DAL\Participant.vb:42 
    SafeAtHome.BLL.Participant.GetParticipantRenewalInformation(Int32 EntityID) in C:\code\web\SafeAtHome2011\SafeAtHome.BLL\Participant.vb:38 
    Participant.getRenewalInformation(Int32 EntityID) in M:\VirtualWebs\Intranet\SafeAtHome\Participants.aspx.vb:3894 
    Participant.BindCombinedParticipants(DataSet dst) in M:\VirtualWebs\Intranet\SafeAtHome\Participants.aspx.vb:3962 
    Participant.grdParticipantSearchActive_Select(Object sender, DataGridCommandEventArgs e) in M:\VirtualWebs\Intranet\SafeAtHome\Participants.aspx.vb:959 
    System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e) +88 
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70 
    System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e) +110 
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70 
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981 




-------------------------------------------------------------------------------- 
Version Information: Microsoft .NET Framework Version:2.0.50727.5420; ASP.NET Version:2.0.50727.5420 


======================================= 
= Application Event Log Warning = 
======================================= 

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 12/6/2012 8:53:00 AM 
Event time (UTC): 12/6/2012 2:53:00 PM 
Event ID: 52ff4f11e1d64e59b020623619f93fe9 
Event sequence: 6 
Event occurrence: 1 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/1/ROOT/SafeAtHome-1-129992790193691690 
    Trust level: Full 
    Application Virtual Path: /SafeAtHome 
    Application Path: M:\VirtualWebs\Intranet\SafeAtHome\ 
    Machine name: SOSDEVINTRA 

Process information: 
    Process ID: 5068 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\ASP.NET 2.0 

Exception information: 
    Exception type: SqlException 
    Exception message: 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 

Request information: 
    Request URL: .../safeathome/Participants.aspx 
    Request path: /safeathome/Participants.aspx 
    User host address: ::1 
    User: test 
    Is authenticated: True 
    Authentication Type: Forms 
    Thread account name: IIS APPPOOL\ASP.NET 2.0 

Thread information: 
    Thread ID: 3 
    Thread account name: IIS APPPOOL\ASP.NET 2.0 
    Is impersonating: False 
    Stack trace: at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 
    at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) 
    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) 
    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) 
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) 
    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) 
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) 
    at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) 
    at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) 
    at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) 
    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) 
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) 
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) 
    at System.Data.SqlClient.SqlConnection.Open() 
    at SafeAtHome.DAL.Participant.GetParticipantRenewalInformation(Int32 EntityID) in C:\code\web\SafeAtHome2011\SafeAtHome.DAL\Participant.vb:line 42 
    at SafeAtHome.BLL.Participant.GetParticipantRenewalInformation(Int32 EntityID) in C:\code\web\SafeAtHome2011\SafeAtHome.BLL\Participant.vb:line 38 
    at Participant.getRenewalInformation(Int32 EntityID) in M:\VirtualWebs\Intranet\SafeAtHome\Participants.aspx.vb:line 3894 
    at Participant.BindCombinedParticipants(DataSet dst) in M:\VirtualWebs\Intranet\SafeAtHome\Participants.aspx.vb:line 3962 
    at Participant.grdParticipantSearchActive_Select(Object sender, DataGridCommandEventArgs e) in M:\VirtualWebs\Intranet\SafeAtHome\Participants.aspx.vb:line 959 
    at System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e) 
    at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) 
    at System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e) 
    at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) 
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) 
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

回答

0

嘗試一些東西

  1. 檢查在哪個帳戶下的站點下運行。轉到AppPools,然後在高級設置中,您應該可以更改它。將其更改爲網絡服務並嘗試解決。

  2. 檢查訪問SQL Server的帳戶是否具有對Sql Server的適當權限。