In my ASP.NET MVC application, I have created the new ADO.net entity object & pointed to (localDB)\mssqllocaldb
(the connection string created automatically, table name tblProduct
). After adding new controller (e.g. Product
) with this entity and trying to access the index page, I'm getting an error.
Note : I am able to connect to the database in SQL Server Management Studio and also able to see the database in DataConnections in the Visual Studio server explorer
Error :
Exception message: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user. )
Application log in Windows Log:
Cannot get a local application data path. Most probably a user profile is not >loaded. If LocalDB is executed under IIS, make sure that profile loading is >enabled for the current user.
Connection string
add name="productsContextV12" connectionString="metadata=res:///Models.products.csdl|res:///Models.products.ssdl|res://*/Models.products.msl;provider=System.Data.SqlClient;provider connection string="data source=(LocalDB)\mssqllocaldb;initial catalog=EMPDB2;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />