C
C#11mo ago
0xcg

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
Saryn
Saryn11mo ago
Verify you can connect to the database from the same machine you are running your code. Most databases required explicit permissions per client ip.
0xcg
0xcgOP11mo ago
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.
Saryn
Saryn11mo ago
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.
Angius
Angius11mo ago
As a side note, any reason you're willing to pay extra for Windows hosting if Linux hosting will do the job?
0xcg
0xcgOP11mo ago
I see. Where can I do these permissions? In panel or code? No, my first time for deployment. So idk Linux.
Saryn
Saryn11mo ago
I don't know anything about Plesk Panel, I also do not work with databases on windows. I apologize, not my area of expertise
0xcg
0xcgOP11mo ago
I see. Thank you
Want results from more Discord servers?
Add your server