0

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

以前一切正常,但现在我们遇到了问题。我对这种类型的身份验证没有经验。在查询数据之前,它似乎要通过一个 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>
4

1 回答 1

1

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

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

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

于 2013-02-06T15:31:56.270 回答