Unable to connect to SQL Server 2019 localdb


I'm part way through writing a .NET Core 3.1 Web API for a project. When I try to connect to the server, postman shows the following message:

Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot open database "aspnet-53bc9b9d-9d6a-45d4-8429-2a2761773502" requested by the login. The login failed.

Login failed for user 'DESKTOP-RDBS4OR\Paul'.

I've looked around and the only things I can see are that I need to create a user for the db. I already have (the db uses the Windows Auth system) and the localdb has this user.

Looking at the throwback, I'm puzzled at the name of the DB - it's not the one in the connection string set in appsettings.json (below) or the referenced name win the StartUp class

"ConnectionStrings": {
    "quizzical": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=quizzical;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"

Something is obviously not right, but I don't know what it is.

This is my first API I've done in .NET (I usually use php), so any tips on fixing this are appreciated.

asked on Stack Overflow Jun 11, 2020 by Nodoid • edited Jun 11, 2020 by marc_s

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0