Windows hosting .net 7.0 web api project doesn't connection mssql database
Hello, i am using .net 7.0 for web api. I built and published project on windows hosting. I tried connection database but i got error 500 internal server. I checked many times my connection string but i didn't find any issue. Then i tried empty GET request without database codes etc. it worked. Why is it connect? Any ideas? Thanks.
7 Replies
Verify you can connect to the database from the same machine you are running your code. Most databases required explicit permissions per client ip.
When I work locally, I connect to the database and have no problems, but I rented Windows hosting with Plesk Panel. When I upload the database there, I cannot connect.
Sounds like a database permissions issue. Verify your database user has permissions for the table from the VPS IP.
Even if the database is on the same machine, user@localhost needs permissions.
As a side note, any reason you're willing to pay extra for Windows hosting if Linux hosting will do the job?
I see. Where can I do these permissions? In panel or code?
No, my first time for deployment. So idk Linux.
I don't know anything about Plesk Panel, I also do not work with databases on windows. I apologize, not my area of expertise
I see. Thank you