sql server - A network-related or instance-specific error on dotnet ef database update -


i'm learning build asp.net core mvc app visual studio this tutorial. in "adding model" step created new separate project (as written in instructions), when rundotnet ef database update, following error occurs:

a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 52 - unable locate local database runtime installation. verify sql server express installed , local database runtime feature enabled.)

but have installed sql server , sqlexpress service running. tried open port, didn't help.

setup localdb

the template's connection string localdb , mssqllocaldb instance. make sure have both.

appsettings.json

{   "connectionstrings": {     "defaultconnection": "server=(localdb)\\mssqllocaldb;database=aspnet-mvcmovie-87ad796f-548e-4862-9713-d2976453319e;trusted_connection=true;multipleactiveresultsets=true"   } } 

make sure have installed localdb. check, open command prompt , run sqllocaldb. print localdb command line information. if don't have localdb, then install it.

make sure have instance named mssqllocaldb. check, run sqllocaldb info. if not have instance, need either create (sqllocaldb create mssqllocaldb) or change connection string point @ instance have.

working example on machine

the dotnet ef database update command runs on machine. here output of various commands @ prompt.

> sqllocaldb info mssqllocaldb  > dotnet ef migrations add initial project mvcmovie (.netcoreapp,version=v1.0) compiled... compiling mvcmovie .netcoreapp,version=v1.0 compilation succeeded.     0 warning(s)     0 error(s) time elapsed 00:00:01.7783361  done. undo action, use 'dotnet ef migrations remove'  > dotnet ef database update project mvcmovie (.netcoreapp,version=v1.0) previously... done. 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -