Learn Host ASP.NET Core – Web API (RESTful) in Azure App Service

Web API is a marvelously huge word that really means "an interface for you to build your own web services with". Web APIs are for the times when you have the application, but not the network that goes with it. A modern web API hosts ASP.NET Core. The core component of a modern system.

Web API is a marvelously huge word that really means "an interface for you to build your own web services with". Web APIs are for the times when you have the application, but not the network that goes with it. A modern web API hosts ASP.NET Core. The core component of a modern system.


In this blog, we will learn host asp.net core -web API in Azure app service

Prerequisite:

  • Visual Studio
  • Azure Account

In this demo, I have already created project. see my previous blog links below

https://netkalon.com/blog/learn-asp-net-core-mvc-with-mssql-using-dapper-orm-restful/

open my project in visual studio

Figure 1

Right click on the project solution & select the Publish in this menu


Figure 2

Now make sure your account login in visual studio. Pick a publish target will appear & currently select the App service tab. I am starting as create new then click Advanced label.it will be appearing one more popup of advanced setting. Once completed the settings click Save & Publish button.


Figure 3

Set your App service name, Resource Group & Hosting Plan. Application Insights is recommended for production Build.


Figure 4

Already I have created a Database using SQL Server. So right now, skip creating a SQL Database method


Figure 5

Once Click Create Button, it will start to deploy information view in output window. My app service completed successfully & you can able to see site URL info on above.


Figure 6

Oops, when I try to look my URL it is seems to show HTTP Error 500.0

If we clear the issue, need to add web.config file in this project.

Add the above XML code in web.config. Publish your app again


Figure 9

Now RESTful API web Service is ready to use & currently I am using Swagger UI in my project.

Let’s look App Service inside an azure portal.  


Figure 10

We can monitor an App Service usage, request & response time


Figure 11