简体   繁体   中英

My web api get 500 internal server after deploy to azure api management

I am new to azure app service, i have used visual studio to deploy my web api to azure api management. i am doing a mobile application project, I need to make local ssms database data sync to azure cloud. because my web api is connect to ssms database, and it has error when i am testing it in azure api management, it response 500 internal server error, but i have the weatherforecast GET Sample, and this api work normal, it response 200 ok. i don't know what i have done wrong to the web api or i set up wrong in the azure.

Check the below steps to deploy sync the local DB to Azure SQL Server.

I need to make local ssms database data sync to azure cloud.

  • In Azure Portal => Create a new SQL Database Server .

在此处输入图像描述

  • Set Admin在此处输入图像描述

In Local DB => Right click on the DB => Tasks =>select Deploy Database to Microsoft Azure SQL Database .

在此处输入图像描述

  • Click on Connect , provide the Server name from Azure Portal (SQL Server Overview page).

在此处输入图像描述

  • Initially I got the below error.在此处输入图像描述

  • To access/ Connect Azure SQL DB , we need to enable Public.network access and add Firewall rules in Azure SQL Server .

在此处输入图像描述

  • Now I have connected to Azure SQL server and deployed local DB Test to Azure SQL Server without any issues.

在此处输入图像描述

  • SQL Database in Azure contains all the data which we have in local DB.
  • Now if we want to make any changes to the DB, from SSMS we need to connect to the Azure SQL DB and make required changes.

在此处输入图像描述

  • I have inserted data by connecting Azure SQL DB , you can see the changes in portal.

在此处输入图像描述

  • Now we need to provide the Azure SQL Connection string in the Web.config file of the ASP.Net Web API .
  • Copy the connection string from Azure SQL DB and paste it in the Web.config file.

在此处输入图像描述

  • Replace the password with your Password.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM