標籤:rod drop git ppi sed 尺寸 creat 下拉 網域名稱
Getting started with ASP.NET Core MVC and Visual Studio
VS開發asp.net core mvc 入門
2017-3-7 2 分鐘閱讀時間長度
本文內容
1.Install Visual Studio and .NET Core
安裝 VS 與 .NET Core
2.Create a web app
建立一個 web 應用
By Rick Anderson
This tutorial will teach you the basics of building an ASP.NET Core MVC web app using Visual Studio 2017.
本教程將會教你如何使用VS2017建立一個基本的asp.net core mvc 應用程式
There are 3 versions of this tutorial:
除此之外,還有其它三個版本的教程(自己翻譯~):
- macOS: Create an ASP.NET Core MVC app with Visual Studio for Mac
- Windows: Create an ASP.NET Core MVC app with Visual Studio
- macOS, Linux, and Windows: Create an ASP.NET Core MVC app with Visual Studio Code
For the Visual Studio 2015 version of this tutorial, see the VS 2015 version of ASP.NET Core documentation in PDF format.
Install Visual Studio and .NET Core
安裝 vs 與 .net core
Install Visual Studio Community 2017. Select the Community download. Skip this step if you have Visual Studio 2017 installed.
安裝vs 2017 社區版。選擇社區版下載。如果你已安裝過可以跳過這個步驟。
- Visual Studio 2017 Home page installer
Run the installer and select the following workloads:
運行這個安裝包,選擇下面的工作項目:
- ASP.NET and web development (under Web & Cloud)
需要勾選的環境一
- .NET Core cross-platform development (under Other Toolsets)
需要勾選的環境二
Create a web app
建立一個 web 應用
From Visual Studio, select File > New > Project.
在vs中選擇 File > New > Project 菜單,建立。
Complete the New Project dialog:
完成 建立項目 對話方塊:
- In the left pane, tap .NET Core
在左邊的窗格,點擊 .net core
- In the center pane, tap ASP.NET Core Web Application (.NET Core)
在中間的窗格,點擊 ASP.NET Core Web Application (.NET Core)
- Name the project "MvcMovie" (It‘s important to name the project "MvcMovie" so when you copy code, the namespace will
命名項目名稱為 MvcMovie
match.)
點擊 OK
Complete the New ASP.NET Core Web Application (.NET Core) - MvcMovie dialog:
完成 New ASP.NET Core Web Application (.NET Core) - MvcMovie 對話方塊:
- In the version selector drop-down box tap ASP.NET Core 1.1
在版本選擇下拉框中選擇 ASP.NET Core 1.1 選項
點擊 Web Application
- Keep the default No Authentication
保持預設的 No Authentication 選擇
點擊 OK
Visual Studio used a default template for the MVC project you just created. You have a working app right now by entering a project
VS使用一個預設的項目模板。在你鍵入項目名稱與選擇少量選項之後就有了一個可以正常工作的 web 應用。
name and selecting a few options. This is a simple starter project, and it‘s a good place to start,
這是一個簡單的入門項目,同時是一個很好的起點,
Tap F5 to run the app in debug mode or Ctrl-F5 in non-debug mode.
點擊 F5 在偵錯模式下啟動這個程式,或者 ctrl+F5 非偵錯模式下運行該程式。
- Visual Studio starts IIS Express and runs your app. Notice that the address bar shows localhost:port# and not something
VS啟動 iis express 用於運行你的 app 程式。注意瀏覽器的地址欄顯示的是ip+port,而不是常見的網域名稱。
like example.com. That‘s because localhost is the standard hostname for your local computer. When Visual Studio creates
這是因為 localhost 是你原生標準主機名稱。當VS建立一個新的web項目,
a web project, a random port is used for the web server. In the image above, the port number is 5000. When you run the app,
一個隨機的連接埠會被 web server 選擇使用。在中,連接埠是5000. 在你自己運行這個app的時候,
you‘ll see a different port number.
你可能會看到一個不同的連接埠。
- Launching the app with Ctrl+F5 (non-debug mode) allows you to make code changes, save the file, refresh the browser, and
在非偵錯模式下啟動應用,允許你做一些代碼變更,儲存檔案,重新整理瀏覽器,並且
see the code changes. Many developers prefer to use non-debug mode to quickly launch the app and view changes.
查看變更。許多開發人員更喜歡使用非偵錯模式快速啟動應用並查看變更。
- You can launch the app in debug or non-debug mode from the Debug menu item:
你可以在 Debug 菜單已調試或非偵錯模式啟動你的app:
- You can debug the app by tapping the IIS Express button
你可以通過點擊 IIS Express 按鈕啟動偵錯工具
The default template gives you working Home, About and Contact links. The browser image above doesn‘t show these links.
預設的模板提供了 Home, About and Contact 三個連結與頁面。中瀏覽器沒有顯示這些連結。
Depending on the size of your browser, you might need to click the navigation icon to show them.
因為依賴於你的瀏覽器寬度尺寸,你可能需要點擊互動中心圖示來顯示他們。
If you were running in debug mode, tap Shift-F5 to stop debugging.
如果你在偵錯模式下運行,點擊 Shift-F5 可以停止調試。
In the next part of this tutorial, we‘ll learn about MVC and start writing some code.
在接下來的教程中,我們將會開始學習 mvc 和如何開始寫一些 代碼 。
蒙
2017-07-12 11:05 周三
005.Getting started with ASP.NET Core MVC and Visual Studio -- 【VS開發asp.net core mvc 入門】