用户'ndt'登录失败,请帮我解读堆栈跟踪

时间:2013-02-06 15:20:37

标签: asp.net mysql connection-string

我正在使用别人的代码。 试图解决它。 我们重新映像了我们的服务器并上传了新的干净文件。 (与以前的相同,只有这些没有被感染) 我还恢复了我创建的数据库备份。

之前一切都有效,但现在我们遇到了问题。 我没有使用此类身份验证的经验。 在查询数据之前,它似乎通过了一个mdf文件。

似乎无法解决登录失败的用户错误。

[SqlException (0x80131904): Login failed for user 'ndt'.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +187
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2297
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +34
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +606
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +220
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +502
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +429
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +70
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +512
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +85
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +104
   System.Data.SqlClient.SqlConnection.Open() +177
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +118
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +140
  System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
  System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1748
  System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +13
  System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
  System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68
  System.Web.UI.WebControls.GridView.DataBind() +4
  NDTCourses.TimeKeeping.WebForm14.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\cflick\Desktop\NDTCourses\NDTCourses\TimeKeeping\declare_time.aspx.cs:264
  System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
  System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
  System.Web.UI.Control.OnLoad(EventArgs e) +98
  System.Web.UI.Control.LoadRecursive() +71
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4315


<connectionStrings>
  <remove name="LocalSqlServer" />
  <add name="LocalSqlServer" connectionString="Data Source=TECH-ILL\\SQLEXPRESS;Initial Catalog=timeKeep;Integrated Security=True"
   providerName="System.Data.SqlClient" />
  <add name="db" connectionString="Data Source=TECH-ILL\\SQLEXPRESS;Initial Catalog=timeKeep;Integrated Security=True" />
  <add name="timeKeepConnectionString" connectionString="Data Source=TECH-ILL\SQLEXPRESS;Initial Catalog=timeKeep;Integrated Security=True"
   providerName="System.Data.SqlClient" />
 </connectionStrings>

1 个答案:

答案 0 :(得分:1)

ndt服务器登录不再存在,或者服务器登录不再与数据库用户(通常称为孤立用户)关联。

在第一种情况下,您需要创建数据库登录,然后处理孤立用户。

将数据库还原到新服务器或重建服务器或重新创建数据库登录时,会发生孤立用户。您可以在http://msdn.microsoft.com/en-us/library/ms175475.aspx找到有关解决此问题的说明。