Azure数据库在部署.NET Core React.js项目后不起作用。

huangapple go评论82阅读模式
英文:

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

  1. 检查你的 appsettings.json - 确保你已经在 appsettings.json 中设置了连接字符串。

  2. 验证连接字符串 - 这可能是由于错误的连接字符串导致的。你可以从 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 服务器名称。

  1. 在你的应用程序中添加一个调试断点,然后运行本地应用程序连接到托管的数据库。这将帮助你了解发生了什么。
英文:

There are a few steps that you can follow to solve this.

  1. Check your appsettings.json - Check whether you have put the connection string in your appsettings.json

  2. 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.

  1. 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.

huangapple
  • 本文由 发表于 2023年2月18日 10:14:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/75490772.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定