A network-related or instance-specific error occurred while establishing a connection to SQL Server while migration with asp.net core migration

被刻印的时光 ゝ 提交于 2020-01-06 06:09:07

问题


I, am using package manager console to perform the database migration.

I used the following command

Add-Migration init

This command work perfectly and created the migration object as see in the below image

Now I am using

Update-Database

command to create the database however I, am getting an error as shown below

I have used the solution provide here and this question.

However, this solution is not working for me from visual studio.

I, am able to use the sql server from SSMS. This error is from visual studio.

Here is the firewall screen shot


回答1:


Might be your connection to SQL is not started. Just follow below steps: 1. Go to run command or press Windows+R key and enter services.msc. 2. Find SQL Server (MSSQLSERVER) there and right click on it and click on start option. Then retry.




回答2:


This solution work for me.I change the statrtup.cs file as per the below repo

https://github.com/bricelam/Sample-SplitMigrations

Add migration with different assembly



来源:https://stackoverflow.com/questions/46260531/a-network-related-or-instance-specific-error-occurred-while-establishing-a-conne

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!