LocalDB and Entity Framework 6 - Security

I'm trying to figure out a way to use LocalDB instead of SQL to test the integration of EF6 queries (this will allow us to run integration tests on our build server). It seems like I should be able to replicate my database in SQL Express, detach and import into my test project. I expect that from there I can change the connection string in my test project to get into the local database file. However, I ran into a security issue. I need to get SQL security to work with the user ID and password in my connection string (since the build server will not use my domain account), but no matter what I try, I get the wrong username or password as soon as I try fulfill the request. The connection string looks like this:

    <add name="ClinicalContext" connectionString="metadata=res://*/ClinicalDataStore.csdl|res://*/ClinicalDataStore.ssdl|res://*/ClinicalDataStore.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ClinicalDataStore.mdf;Integrated Security=False;User Id=SomeUser;Password=SomeUsersPassword;&quot;"
  providerName="System.Data.EntityClient" />

Does anyone have any experience with this and know if I need to do something to get the SQL system to work this way?

Update I connected the database file through Server Explorer and checked the updated connection string. The only change was to add the source directory and change the protection to integrated. If I try to connect in this way, I get an error that it cannot access the directory as a specific name. If I go back to sql security, I still get the wrong username or password error.

+4
source share

Source: https://habr.com/ru/post/1539473/


All Articles