2012-12-06 90 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的适当权限。