当我尝试运行包含EntityDataSource和Listview的页面时,我收到了用户'NT AUTHORITY / NETWORK SERVICE'的臭名昭着的登录失败。这是堆栈跟踪:
[SqlException(0x80131904):用户'NT AUTHORITY \ NETWORK SERVICE'登录失败。] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,Boolean breakConnection)+4846887 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)+194 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)+2392 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)+35 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo,String newPassword,Boolean ignoreSniOpenTimeout,Int64 timerExpire,SqlConnection owningObject)+144 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host,String newPassword,Boolean redirectedUserInstance,SqlConnection owningObject,SqlConnectionString connectionOptions,Int64 timerStart)+342 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject,SqlConnectionString connectionOptions,String newPassword,Boolean redirectedUserInstance)+221 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity,SqlConnectionString connectionOptions,Object providerInfo,String newPassword,SqlConnection owningObject,Boolean redirectedUserInstance)+189 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项,Object poolGroupProviderInfo,DbConnectionPool池,DbConnection owningConnection)+185 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection,DbConnectionPool pool,DbConnectionOptions选项)+31 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)+433 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)+66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)+499 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)+65 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory)+117 System.Data.SqlClient.SqlConnection.Open()+ 122 System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition,DbConnection storeConnectionToOpen,DbConnection originalConnection,String exceptionCode,String attemptsOperation,Boolean& closeStoreConnectionOnFailure)+47
[EntityException:底层提供程序在Open上失败。]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition,DbConnection storeConnectionToOpen,DbConnection originalConnection,String exceptionCode,String attemptOperation,Boolean& closeStoreConnectionOnFailure)+168
System.Data.EntityClient.EntityConnection.Open()+96
System.Data.Objects.ObjectContext.EnsureConnection()+81
System.Data.Objects.ObjectQuery 1.GetResults(Nullable
1 forMergeOption)+46
System.Data.Objects.ObjectQuery 1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +39
System.Linq.Enumerable.Single(IEnumerable
1 source)+107
System.Data.Objects.ELinq.ObjectQueryProvider.b__2(IEnumerable 1 sequence) +5
System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable
1个查询,表达式queryRoot)+25
System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression)+43
System.Linq.Queryable.Count(IQueryable 1 source) +240
System.Web.UI.WebControls.EntityDataSourceQueryBuilder
1.Build(ObjectContext context,Boolean computeCount)+154
System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments,Creator qbConstructor)+889
System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)+102
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments参数,DataSourceViewSelectCallback回调)+19
System.Web.UI.WebControls.DataBoundControl.PerformSelect()+ 142
System.Web.UI.WebControls.ListView.PerformSelect()+57
System.Web.UI.WebControls.BaseDataBoundControl.DataBind()+73
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()+82
System.Web.UI.WebControls.ListView.CreateChildControls()+55
System.Web.UI.Control.EnsureChildControls()+87
System.Web.UI.Control.PreRenderRecursiveInternal()+ 44
System.Web.UI.Control.PreRenderRecursiveInternal()+171
System.Web.UI.Control.PreRenderRecursiveInternal()+171
System.Web.UI.Control.PreRenderRecursiveInternal()+171
System.Web.UI.Control.PreRenderRecursiveInternal()+171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)+842
这是我的EntityDataSource的内容:
<asp:EntityDataSource ID="PartsDataSource" runat="server"
ConnectionString="name=Diel_inventoryEntities"
DefaultContainerName="Diel_inventoryEntities" EntitySetName="PartList"
EntityTypeFilter="PartList"
Select="it.[PARTNUMBER], it.[NSN], it.[PARTNAME], it.[REV], it.[CUSTOMER]">
</asp:EntityDataSource>
除了创建.edmx文件,listview和entitydatasource之外,我还需要采取其他步骤来解决此错误消息吗?
谢谢, SID
答案 0 :(得分:6)
这意味着用户NT AUTHORITY / NETWORK SERVICE用于登录数据库,并被拒绝。您应该使网站在不同的用户帐户下运行(使用模拟),或更改连接字符串以指定sql帐户/通行证。这两种解决方案都要求您在SQL Server中创建登录,并授予该用户必要的权限。
答案 1 :(得分:0)
试试这个。我在新的IIS
设置时遇到了同样的错误。我用过:
"integrated security=false;User Id=sa;Password=yourpassword"