Ten minutes to get to know ASP. NET 5 (MVC6), asp. netmvc6

Source: Internet
Author: User

Ten minutes to get to know ASP. NET 5 (MVC6), asp. netmvc6

ASP. NET 5 is coming soon. I have been studying for two months. Today, I will write a simple ten-minute tutorial to my colleagues who have no contact with asp.net 5 to teach you how to get to know asp.net 5.

 

1. Install kvm

First, open cmd as an administrator and execute the following script:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.ps1'))"

 

 

After installation, install the latest version of KRE through kvm install latest-p.

 

2. Create the first application (Startup. cs and project. json)

In asp.net 5, the two most important files are Startup. cs and project. json.

Project. json file Description: https://github.com/aspnet/Home/wiki/Project.json-file

Startup. cs is the file found when the asp. net5 application starts, as shown in its name.

The following are the project. json and Startup. cs files.

A. Create an empty project. json file:

Run the following command in the current path:

The above command is the most basic package for installing and running the asp.net application. As shown in:

After the installation is complete, the project. json file is automatically updated:

 

Next, add the command node to the project. json file:

"commands": {    "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"    }
The project. json file is as follows:

Now we have created the project. json file. Create the Startup. cs file.

Only the Hello World code is output.
 
3. Use k web to run the application.
The web command is defined in the project. json file. It will makeMicrosoft. AspNet. Server. WebListener listens to port 5000
 
4. Browse the page:
 
If you want to learn more about ASP. NET 5, refer to a project I'm learning, https://github.com/nicholaspei/OrchardNoCMS
There will be continuous updates to introduce the basic knowledge and features of ASP. NET 5.
 

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.