ASP.NET Core 入门

ASP.NET Core 入门

安装 .NET Core 2.1 SDK or later

创建 ASP.NET Core 项目。 打开命令行界面,输入以下命令:

1
dotnet new webapp -o aspnetcoreapp

信任 HTTPS 开发证书:

Windows

1
dotnet dev-certs https --trust

The preceding command displays the following dialog:

PNG

Select Yes if you agree to trust the development certificate.

macOS

1
dotnet dev-certs https --trust

The preceding command displays the following message:

Trusting the HTTPS development certificate was requested. If the certificate is not already trusted we will run the following command:

'sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain <<certificate>>'

This command might prompt you for your password to install the certificate on the system keychain.Password:

Enter your password if you agree to trust the development certificate.

Linux

See the documentation for your Linux distribution on how to trust the HTTPS development certificate

运行应用:

1
2
cd aspnetcoreapp
dotnet run

浏览到 http://localhost:5001。 单击“接受”,接受隐私和 cookie 政策。 此应用不保留个人信息。

打开 Pages/About.cshtml,修改该页面,浏览到 http://localhost:5001/About 并验证是否显示更改。

×

谢谢你请我吃辣条

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
  1. 1. ASP.NET Core 入门
  2. 2. Windows
  3. 3. macOS
  4. 4. Linux
    1. 4.1. See the documentation for your Linux distribution on how to trust the HTTPS development certificate
,