Open
Visual Studio 2017
Create a new Project of type Asp.Net Core Web Application
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]")]
[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.
Build and run the project, the following will be displayed in the browser.
No comments:
Post a Comment