An error occurred using the connection to database on server

created at 07-05-2021 views: 1

error message

When doing EF Core Migration, the Update-dataBase command always reports an error: 

"An error occurred using the connection to database'' on server '10.28.253.2'"

When doing data migration, follow the usual operations

  • Add-Migration init (execute this command project to generate a directory (Migration))
  • Update-Database init

The database connection string used can be successfully queried before, and the string content is as follows

"ConnectionStrings": {
    "Default": "Data Source = 10.28.253.2;Initial Catalog = SignalR;User Id = sa;Password =Ecsgui123;"

However, after copying it today, a life-and-death execution error was reported. The error content is shown in the following figure:

error message

solution

When I was looking for the error, I also found the wrong sentence. I used the "Access denied for user" in the green icon. This sentence is the prompt message of the last line of the execution error. There is a "10.28.160.250" that is not always present in the program. "This address, I found a garbled code

Checking the error code carefully, I found that the initial error content IP is correct, but the message is not connected, the red box content, so I added the content of "Integrated Security=False;" to the connection string, and the problem is solved here.

"ConnectionStrings":

"Default": "Data Source = 10.28.253.2;Initial Catalog = SignalR;User Id = sa;Integrated Security=False;Password =Ecsgui123;"
Please log in to leave a comment.