ASP.NET Tutorial - Hello World in 10 minutes
https://dotnet.microsoft.com/learn/web/aspnet-hello-world-tutorial/install
下载安装
当前环境是Mac
创建网站
dotnet new webApp -o myWebApp --no-https
cd myWebApp
- The
-o
parameter creates a directory namedmyWebApp
where your app is stored. - The
--no-https
flag specifies not to enable HTTPS. - The
cd myWebApp
command puts you into the newly created app directory.
运行
dotnet run
Once the command completes, browse to http://localhost:5000
screenshot-aspnet-tutorial-run.png
修改代码
Open Pages/Index.cshtml
in any text editor and replace all of the code with the following:
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<h1>Hello, world!</h1>
<p>The time on the server is @DateTime.Now</p>