0

I published ASP.NET MVC Core 1.1.1 project to production along with its SQL Server 2012 db. After a few days, I backed up and restored the db from production server to development machine and reconnected it to my VS2017 development project. But when I try to run the app it gives me the following error:

A database operation failed while processing the request. InvalidOperationException: An exception has been raised that is likely due to a transient failure. If you are connecting to a SQL Azure database consider using SqlAzureExecutionStrategy. SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) Win32Exception: No process is on the other end of the pipe 

I checked the same db login by connecting with this same login to SSMS and it successfully connects to the db.

Moreover, below the above error message, there is following message with the list of all migrations the project has:

Applying existing migrations for MyProjectContext may resolve this issue There are migrations for MyProjectContext that have not been applied to the database 20161209232754_myFirstMigration 20170121191004_mySecondMigration 20170303172256_myThirdMigration 20170303172256_myFourthMigration In Visual Studio, you can use the Package Manager Console to apply pending migrations to the database: PM> Update-Database Alternatively, you can apply pending migrations from a command prompt at your project directory: > dotnet ef database update 

NOTE:

  1. Development machine is Windows 10, Production sever is Windows Server 2012-R2. Both the machines have same editions of SQL Server 2012.
  2. I've verified that both the VS2017 project and the Db have exact same migrations on the local development machine. After deployment to production the migrations were never changed on development machine. And when I run the recommended command PM> Update-Database -context MyProjectContext from the error message above, I get the error: CREATE DATABASE permission denied in database 'master'.

1 Answer 1

3

I've had a similar case in the past, where the CREATE DATABASE permission denied in database 'master' message was caused by omitting the connection string entirely (which sounds like a dumb thing to do, but it can happen through bad configuration of a multi-project solution).

Check your configuration string exists, has the name you expect it to have, and is visible to your application when running. If you have your Entity Framework code in a class library, which is shared with the main application, make sure you choose the main application as your startup project before applying migrations, so EF knows where to look for the App.config file.

Sign up to request clarification or add additional context in comments.

1 Comment

That was it. Login/password were correct but not the entire connection string. Thank you for guiding me to the right directions.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.