2012-11-29 9 views
18

이 비디오는 기존 데이터베이스에서 코드 퍼스트를 사용하는 방법을 보여줍니다. http://msdn.microsoft.com/en-us/data/jj572367EF5 코드에서 데이터베이스를 리버스 엔지니어링하려고 시도 할 때 예외가 발생합니다.

그래서 Nuget을 사용하여 EF Power Tools를 설치하고 프로젝트를 선택하고 마우스 오른쪽을 클릭하여 선택하십시오. Entity Framework -> Reverse Engineer Code First. 설명 된대로 데이터베이스를 선택하지만 OK를 클릭하면 다음 예외가 발생합니다.

System.Data.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. ---> System.InvalidOperationException: This operation requires a connection to the 'master' database. Unable to create a connection to the 'master' database because the original database connection has been opened and credentials have been removed from the connection string. Supply an unopened connection. ---> System.Data.SqlClient.SqlException: Login failed for user 'ictdev'. 
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() 
    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 
    at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) 
    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) 
    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) 
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, 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.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) 
    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 System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) 
    at System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) 
    --- End of inner exception stack trace --- 
    at System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) 
    at System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) 
    at System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) 
    --- End of inner exception stack trace --- 
    at System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) 
    at System.Data.Entity.Design.EntityStoreSchemaGenerator.GetProviderSchemaMetadataWorkspace(DbProviderServices providerServices, DbConnection providerConnection) 
    at System.Data.Entity.Design.EntityStoreSchemaGenerator.CreateStoreSchemaConnection(String providerInvariantName, String connectionString) 
    at System.Data.Entity.Design.EntityStoreSchemaGenerator..ctor(String providerInvariantName, String connectionString, String namespaceName) 
    at Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project) 

문제는 어떻게 수정합니까?

답변

48

EF Power Tools 제품 웹 페이지의 의견에 대한 해결책을 찾았습니다. http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d

연결 마법사에서 고급을 클릭하고 Persist Security Info의 값을 True로 설정해야합니다.

누구든지 원래 질문에 답변하고이 작업을 수행 할 때 어떤 일이 벌어지고 있는지 설명 할 수 있다면 답변을 표시 할 수 있습니다.

+5

여기에 무슨 일이 일어나고 있고 왜 이렇게해야하는지 ... http://blog.longle.net/2013/02/05/system-data-providerincompatibleexception-withentent-framework-power-tools- 베타 -2 및 베타 -3 / – LeLong37

관련 문제