Saturday, July 27, 2019

Creating a HelloWorld WebAPI Project in Asp.Net Core

Open Visual Studio 2017
Create a new Project of type Asp.Net Core Web Application



Select the API template



Project will get created with the following files


Open the ValuesController, replace the default code with the following code.

    [Route("api/[controller]")]
    [ApiController]
    public class ValuesController : ControllerBase
    {
        // GET api/values
        [HttpGet]
        public ActionResult<string> Get()
        {
            string strValue = "Hello Web API";
            return strValue;
        }
         }

Build and run the project, the following will be displayed in the browser.







Search Flipkart Products:
Flipkart.com

No comments: