Contact for queries :

Login

Create ASP.NET WEB API

Create ASP.NET WEB API Empty Project

API stands for Application Programming Interface. A Web API is an application programming interface for the Web, 

That’s where the waiter or API comes in. The waiter is the
messenger – or API – that takes your request or order and tells the kitchen –
the system – what to do. Then the waiter delivers the response back to you; in
this case, it is the food.

Examples:                  

  • YouTube
    API – Allows you to display videos on a web site.
  • Twitter
    API – Allows you to display Tweets on a web site.
  • Facebook
    API – Allows you to display Facebook info on a web site.
 

Create ASP.NET WEB API Empty Project

 

1)    Select New Project > Visual C# -> Web -> ASP.NET Web Application (.net framework) and enter your application name. Here, I named it “TMSAPICOMPANY”. Now, click OK.

2) Select Empty Web API template and click OK to create the project.

3) Once you click OK, the project will be created with the basic architecture of ASP.NET WEB API

4) To install Entity Framework from NuGet, right click on References and select Manage NuGet Packages.

5) And now, search EntityFramework online to install and add the reference to your project. 

6) After installing the EntityFramework from NuGet, it will be added as a reference to our project.

  7) Right click on Models folder and select Add->ADO.NET Entity Data

  Right click on Models folder and select Add->ADO.NET Entity Data

8) Right click on Controllers folder under your project-> select Add-> Controller 

To implement scaffolding Select “Web API 2 Controller with actions, using Entity Framework” and click add

Again controller step follow. End of controller

9) Install Microsoft.AspNet.WebApi.cors in References<NuGet package manager.

(A) Goto your Web API project->Open the WebConfig file and add the below code

        <system.webServer>  

       <directoryBrowse enabled=”true” />  

         </system.webServer>  

 

 

 (B)  And add below code to your WebApiConfig.cs file

                                                 

config.EnableCors(new EnableCorsAttribute(“*”, “*”, “GET,PUT,POST,DELETE”));

Now run your application, Yes! We got the successful services. We will validate all actions(CRUD) using postman

10) Postman is a free API debugging tool. Install it for Chrome from Here. Or visit Herefor others 

END OF WEB API

0 responses on "Create ASP.NET WEB API"

Leave a Message

Your email address will not be published. Required fields are marked *

TrueBodh Technologies Pvt. Ltd.
TrueBodh Technologies Pvt. Ltd.

About Truebodh Technologies

We provide IT Services in Software Development, Web Applications, Mobile Apps, Cloud Services & Solutions to end to end business design.

We provide online learning platform that helps anyone learn software, technology and creative skills to achieve personal and professional goals.We help individual learners achieve personal and professional goals, we offer flexible, cost-effective price. We provide online and offline courses.

Course Progress

top
X