Create the first Web API project using a template

Source: Internet
Author: User

Software Environment

VS Update3

This section explains how to create a Web API project by using an example

The first step, open vs, through the File menu, the new Project command, the approximate steps such as:

2nd, in the pop-up dialog, select the Web under the C # template on the left, and then choose the first selection based on the traditional Framework4.5.2, roughly as follows:

The 3rd step, based on the previous step, selects the WebAPI template, which automatically references the core references of MVC and WebAPI, roughly as follows:

After successful creation, the approximate directory structure is as follows:

The above directory structure is very similar to the MVC organizational structure,

App_start: Once the routing configuration is initialized,

areas: Module folder, note defining each module.

Content:CSS style files are already picture resource files.

fonts: defines a font resource

Controllers: controller.

Models: Business Entities

Views: View Page

Scripts: JavaScript files

Results: The Ihttpactionresult interface has been encapsulated with a common logic Httpresponsemessage implementation Class (later chapters will be described, see the Web API Operation return result type section for details)

Here we generate a complete API project, which runs directly by F5 and generates a WPI help page as follows:

In this section, you'll end up with a template for building a Web API project. Introduction to the directory structure

If you do not understand, please refer to the following documents:

Getting Started with Web APIs

Create the first Web API project using a template

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.