Create and use Web APIs to create webapis

Source: Internet
Author: User

Create and use Web APIs to create webapis

Today I made an exercise to implement a separate Web API project. Previously, it was created only in the ASP. net mvc project.


To create a Web API project, follow these steps:




After you click OK, another window is displayed:

 

 
Create a table in the database:

 

Based on this table, we create a model in the API project:



Next, we can create a controller:

 

Select Web API 2 Controller-Empty:

 
The Controller has been created as follows:

 
Create several stored procedures in the database:

 
In the Web API project, create a directory Entities and create an entity SizeEntity:

 

The Api controller created on the Back-to-top interface:

 

Next, you need to publish the Web API item directory to the IIS website.

 

Publish to IIS:

 


Enter the address in the browser:

 
Source code of this article:
Http://download.cnblogs.com/insus/mvc/MiZiAPI.rar

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.