先決條件(開發(fā)配置二選一):
-
?帶有 ASP.NET 和 Web 開發(fā)工作負載的Visual Studio
-
Visual Studio Code
- Visual Studio Code
- 用于 Visual Studio Code 的 C#(最新版本)
- .NET 7.0 SDK
創(chuàng)建Web應用
-
visual studio
?ctrl + F5 (開始執(zhí)行,不調試)
-
?VS Code
在代碼工作區(qū)間文件夾路徑下打開終端運行下面的命令
dotnet new mvc -o MvcMovie
code -r MvcMovie
?通過運行以下命令來信任 HTTPS 開發(fā)證書:
dotnet dev-certs https --trust
PS D:\Colde\asp.net\vs_code_workspace\MvcMovie> dotnet dev-certs https --trust
Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously trusted. Click yes on the prompt to trust the certificate.
Successfully trusted the existing HTTPS certificate.
PS D:\Colde\asp.net\vs_code_workspace\MvcMovie>
編譯運行文章來源:http://www.zghlxwxcb.cn/news/detail-509948.html
PS D:\Colde\asp.net\vs_code_workspace\MvcMovie> dotnet build
MSBuild version 17.6.3+07e294721 for .NET
正在確定要還原的項目…
所有項目均是最新的,無法還原。
MvcMovie -> D:\Colde\asp.net\vs_code_workspace\MvcMovie\bin\Debug\net7.0\MvcMovie.dll
已成功生成。
0 個警告
0 個錯誤
已用時間 00:00:00.63
PS D:\Colde\asp.net\vs_code_workspace\MvcMovie>
PS D:\Colde\asp.net\vs_code_workspace\MvcMovie> dotnet run
正在生成...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5290
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: D:\Colde\asp.net\vs_code_workspace\MvcMovie
文章來源地址http://www.zghlxwxcb.cn/news/detail-509948.html
到了這里,關于ASP.NET Core MVC -- 入門的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!