Login failed for LocalDb

asp.net sql-server connection-string localdb

637 просмотра

1 ответ

We have two sample ASP.NET MVC web applications installed from internet both using SQL EXPRESS LocalDb. When we open one app in VS2015 we can access the LocalDb in the Server explorer of VS2015. But when we close the first app and open the second app in VS2015 and try to access LocalDb in the server explorer we get the following error: Cannot open database "AspnetSampleVS2015-2-1-alpha1" requested by the login. The login failed. Login failed for user 'myDomain\domainUserName'. In web.config file the connection string for both the app are similar except for the db name. The connection string for the second app is:

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=AspnetSampleVS2015-2-1-alpha1;Integrated Security=SSPI" providerName="System.Data.SqlClient" />

Moreover, when in solution explorer we open the C:\Users\myUsername folder we can see some LocalDb .mdf and .ldf files but no LocalDb files for the above mentioned second LocalDb that leads us to believe that this LocalDb was not installed at all. But the error (shown above) does not indicate it. This sample was installed through NuGet.

Автор: nam Источник Размещён: 16.10.2019 11:21

Ответы (1)


0 плюса

The connection string has changed for VS2015, try this

(LocalDb)\MSSQLLocalDB
Автор: Kyle Bachmann Размещён: 01.03.2016 11:03
Вопросы из категории :
32x32