英文:
Azure database not working after deploying .net core react js project
问题
我完全不懂Azure。当我尝试在Azure上发布.NET Core应用程序时,它已经发布并显示了界面,但似乎数据库不起作用,我无法提交表单数据。在控制台中显示500错误。这是链接:
Azure网站链接
英文:
I am completely noob to Azure. When I try to publish .net core app on Azure. its published and interface is showing, but it seems like database is not working i am unable to submit form data. in console it gives 500 error. here is the link:
Azure site link
答案1
得分: 1
-
检查你的 appsettings.json - 确保你已经在 appsettings.json 中设置了连接字符串。
-
验证连接字符串 - 这可能是由于错误的连接字符串导致的。你可以从 Azure 数据库获取正确的连接字符串。它类似于这样(
Server=tcp:mssql-care-dev.database.windows.net,1433;Initial Catalog=sqldb-care-dev;Persist Security Info=False;User ID=MsSqlAdmin;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
)
将 {your_password} 替换为你的实际密码,以及 SQL 服务器名称。
- 在你的应用程序中添加一个调试断点,然后运行本地应用程序连接到托管的数据库。这将帮助你了解发生了什么。
英文:
There are a few steps that you can follow to solve this.
-
Check your appsettings.json - Check whether you have put the connection string in your appsettings.json
-
Validate the connection string - This might be a result of a wrong connection string. You can get the correct connection string from the Azure Database. It's something similar to this (
Server=tcp:mssql-care-dev.database.windows.net,1433;Initial Catalog=sqldb-care-dev;Persist Security Info=False;User ID=MsSqlAdmin;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
)
Replace {your_password} with your actual password. And the SQL server name.
- Add a debug point in your application. And then run the local application against the hosted database. This will give you an insight into what's happening.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论