0

當我嘗試運行包含EntityDataSource和Listview的頁面時,我收到臭名昭着的Login Failed for User'NT AUTHORITY/NETWORK SERVICE' 。這裏的堆棧跟蹤:當ASP使用EntityDataSource時,用戶'NT AUTHORITY/NETWORK SERVICE'登錄失敗:ListView

[SQLEXCEPTION(0x80131904):用戶登錄失敗 'NT AUTHORITY \ NETWORK SERVICE'。] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException異常,布爾breakConnection)4846887 System.Data .SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)194 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand的cmdHandler,SqlDataReader的數據流,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 (SqlConnection擁有對象)+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 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選項,對象poolGroupProviderInfo,DbConnectionPool池,DbConnection擁有連接)+185 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(的DbConnection owningConnection,池類DBConnectionPool,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.OpenStoreConnec tionIf(布爾openCondition,的DbConnection storeConnectionToOpen,的DbConnection originalConnection,字符串exceptionCode,字符串attemptedOperation,布爾& closeStoreConnectionOnFailure)47

[EntityException:基礎提供失敗上打開] System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(布爾openCondition,的DbConnection storeConnectionToOpen,的DbConnection originalConnection,字符串exceptionCode,字符串attemptedOperation,布爾& closeStoreConnectionOnFailure)168 System.Data.EntityClient.EntityConnection.Open()96 System.Data.Objects.ObjectContext.EnsureConnection()81 系統.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源)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(表達式表達式)+43 System.Linq.Queryable.Count(IQueryable 1 source) +240 System.Web.UI.WebControls.EntityDataSourceQueryBuilder 1.Build(ObjectContext上下文,布爾computeCount)+154 System.Web.UI.WebControls.EntityDataSourceView。的ExecuteSelect(DataSourceSelectArguments參數,造物主qbConstructor)889 System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments參數)+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.DataBind() 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(布爾includeStagesBeforeAsyncPoint,布爾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,還有其他需要採取的步驟來解析e這個錯誤信息?

感謝, 希德

回答

6

這意味着用戶NT AUTHORITY/NETWORK SERVICE用於登錄到數據庫,並且被拒絕。您應該使網站運行在不同的用戶帳戶下(使用模擬),或更改連接字符串以指定sql帳戶/傳遞。這兩種解決方案都要求您在SQL Server中創建登錄名,並授予該用戶必要的權限。

+0

我在SSMS中創建了這個用戶帳號,給了它datareader訪問權限,現在都很好。謝謝你的幫助! – SidC 2009-12-21 04:44:43

0

試試這個。我遇到了同樣的錯誤,新設置了IIS。我用過:

"integrated security=false;User Id=sa;Password=yourpassword" 
相關問題