This article mainly describes how to build a WEBAPI project. There are two ways to build a webapi:
First, create a new WEBAPI project directly with VS, the following steps:
The first step:
Create a new empty Web application that can be understood as a host of Webapi
Click OK
Step Two:
Click OK to create the success!
This completes a WEBAPI project creation, VS will help us to import the relevant assemblies and packages, for short, fool-like installation, haha!
Second, starting from 0 installation
The first step:
Click OK!
Step Two:
Click OK to complete an empty Web application build
Then manually add a reference to the relevant WEBAPI!
Step three: Add dependent assemblies and packages
There are two ways to add dependent dependencies for Webapi:
(1), simplest and most straightforward, add Webapi dependencies by "Manage NuGet packages"
Click Install, I have installed here, so there is no installation option.
Open the Packages.config file below the project as follows
OK, indicating WEBAPI installation is successful
(2), through the Package Manager console to add Webapi dependent
OK, add success, open the Packages.config file below the project as follows
OK, the same installation is successful
Third, the first type of fool and the second starting from 0 to build WEBAPI project Scaffolding differences
By observing both of the Packages.config files found, in fact, there is still a difference between the two, such as:
Fool-style building Webapi project more than the above red box of several packages, a class is the corresponding Chinese package (Zh-hans), the other is a help page, of course, you can not need, these additional packages, is Microsoft to help us improve the efficiency of development use, of course, if you need, You can add it yourself through the NuGet Package Manager.
OK, so far, the simple WEBAPI project scaffolding is completed, all the dependencies are as follows:
Web API Series two WEBAPI basic framework construction