Running the ASP.NET Core Web API project
Our ASP.NET Core Web API was created by Visual Studio 2017 IDE for the Windows environment and Yeoman generator for Linux/ macOS. We will run the application using either IIS Express or the Kestrel server.
Before running the application, let's understand more about the Values
controller (created by default). Under the Controllers
folder it has a C# class file named ValuesController.cs
:
using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; namespace MyFirstCoreAPI.Controllers { [Route("api/[controller]")] public class ValuesController : Controller { // GET api/values [HttpGet] public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } // GET api/values/5 [HttpGet("{id}")] public string Get(int id) { return "value"; } // POST api/values ...