2013-01-04 3 views
1

Entity Framework 코드 우선 문제가있는 것 같습니다. App_data 내 프로젝트 폴더에 데이터베이스를 만들 수 있도록 관리하고 서버 탐색기에서 생성 된 데이터베이스의 내용을 확인하지 않으면 모든 것이 잘 작동합니다.데이터베이스 내용을 확인하면 응용 프로그램에서 오류가 발생합니다.

내가 그렇게하고 응용 프로그램을 열려고하면이 오류 얻을 : 제가 DB를 분리하더라도,

Cannot open database "SellCars" requested by the login. The login failed.
Login failed for user 'Aly-PC\Aly'.

이 문제가 (정말 확실) 정상 수 있지만를과의 연결을 닫습니다

<add name="CarsEntities" 
     connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename='D:\Projects IDE\Visual Studio\MyWork\Websites\SellCars\SellCars\App_Data\SellCars.mdf';Initial Catalog=SellCars;Integrated Security=True;User Instance=True" 
     providerName="System.Data.SqlClient" /> 
: 이것은 내 연결 문자열입니다

One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup.
Cannot open database "SellCars" requested by the login. The login failed.
Login failed for user 'Aly-PC\Aly'.
Log file 'D:\Projects IDE\Visual Studio\MyWork\Websites\SellCars\SellCars\App_Data\SellCars.ldf' does not match the primary file. It may be from a different database or the log may have been rebuilt previously

: 나는 여전히 작동하지 않는 대신에이 응용 프로그램을 실행하고 서버 탐색기이 오류가 발생합니다

데이터를 추가하지 않고 데이터베이스 내부를 변경하려고 시도하지는 않지만 이러한 오류가 계속 발생합니다.

어떻게해야합니까?

답변

1

Aly-PC\Aly을 SQL 서버에 액세스 할 수있는 활성 디렉토리 사용자에 추가하십시오. 그런 다음 방금 작성한 SQL Server 로그인을 데이터베이스에 추가하십시오.

관련 문제