C
C#2y ago
M B V R K

✅ SQL Server issue

Hi friends, I'm working on an ASP.NET COre 7 WEB APIproject, this project depending on a Sql server database, using EF Core. The Issue: When I start the API and try to post a test I get the error shown in the attachments. But the Sql server is works fine and I can login to it normal (As shown in the attachments) Additional Info: SQL Server Version: is SQL Server 2022 Enterprise Connection String: The connection string I use in the appSettings.json is the following :
"ConnectionStrings": {
"DefaultConnection": "Server=MBARK;Database=IContacts;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True;"
},
"ConnectionStrings": {
"DefaultConnection": "Server=MBARK;Database=IContacts;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True;"
},
Windows User Actually when I installed the windows I didn't created a local user I directly logged in to my Microsoft account. Please I hope someone to provide a help, because of I get tired from attempting many methods. Massive thanks in advance
13 Replies
Jimmacle
Jimmacle2y ago
your connection string doesn't have any login credentials you can log into your sql server, but your application can't
M B V R K
M B V R KOP2y ago
Do you have any Idea how do I can fix it Please ?
Jimmacle
Jimmacle2y ago
by giving your application valid credentials to log into your sql server?
M B V R K
M B V R KOP2y ago
I already created a new login and passed its credentials in the connection string but I get the same issue omg this damn shit will make me pepecry
Jimmacle
Jimmacle2y ago
probably a permissions issue on the sql server side then make sure the login is enabled, allowed to connect, and has permissions on the database you want it to use
M B V R K
M B V R KOP2y ago
I use Code First approach, so the database will not created (from migrations) before the loging
Jimmacle
Jimmacle2y ago
code first doesn't create the database, it creates the contents of the database so IContacts should exist as a database but have no tables/etc in it
M B V R K
M B V R KOP2y ago
But what if I want to create a login that have all permissions ?
Jimmacle
Jimmacle2y ago
what's stopping you from doing that?
M B V R K
M B V R KOP2y ago
Do you have a link that taling about this topic please ?
Jimmacle
Jimmacle2y ago
Guru99
How to Create Login, User and Grant Permissions in SQL Server
In this tutorial, you will learn How to create a user in SQL Server, Create a user using T-SQL, Assigning Permission to a user, and Grant Permissions in SQL
M B V R K
M B V R KOP2y ago
Alright I will try this solution @fixed(void* x = &Jimmacle) Massive thanks mate the issue was fixed I appreciate
Jimmacle
Jimmacle2y ago
pepeok
Want results from more Discord servers?
Add your server