Setting up the environment
Before we explore the communication mechanism, let's first set up the development environment. We will use Visual Studio 2017 for our examples.
Open Visual Studio and undertake our favorite step, File | New | Project, which opens up a dialog window with available templates, as shown in the following screenshot:
Select ASP.NET Core Web Application as shown in the preceding screenshot. Don't forget to select .NET Core in the left-hand side panel. Everything looks cool now.
Let's click OK and then we will land on another dialog where we can select more templates related to our web app. Obviously, we will click on Web API and then click OK.
The project is created. Beautifully, it has crafted all the necessary components and created an example controller for us named ValuesController as shown in the following screenshot:
Now, here is one interesting fact. Notice that the ValuesController class inherits the Controller base class. If you were familiar with Web API in ASP.NET before Core, you might know that the base class was ApiController instead. The reason behind this change is to have a uniformity between API and MVC structures. Controller was the base class in ASP.NET MVC. Now in ASP.NET Core, both MVC and Web API templates inherit the same base class. With ASP.NET Core, MVC and Web API are merged into one programming model.