The ASP. NET 5 is almost released. I have been studying for two months. Write a simple 10-minute tutorial to get to know ASP. NET 5 today for those of you who are not in touch with ASP.
1. Installing the KVM
First, you have to open PowerShell 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 via KVM install Latest–p.
2. Create the first application (Startup.cs and Project.json)
In ASP. 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, as its name implies, is the file that the ASP.NET5 application is looking for when it starts.
Here is the creation of our Project.json and Startup.cs files.
A. Create an empty file for Project.json:
Execute the following command under the current path:
The above command installs the most basic package that runs the ASP. As shown in the following:
After the installation is complete, you can see that the Project.json file is automatically updated:
The next thing to do is to add the command node to the Project.json file:
"commands": { "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000" }
project.json文件如下:
现在我们就完成了project.json文件的创建。下面创建Startup.cs文件。
Only the simple output of Hello World code.
3. Use the K Web to run the application.
This command of the web is defined in the Project.json file. It will letMicrosoft.AspNet.Server.WebListener监听5000这个端口
4.浏览页面:
If you want to learn more about ASP 5, you can refer to one of the projects I'm learning, Https://github.com/nicholaspei/OrchardNoCMS
The documentation continues to be updated to introduce the basics and features of ASP.
10 minutes easy for you to know ASP. NET 5 (MVC6)