<input id="ohw05"></input>
  • <table id="ohw05"><menu id="ohw05"></menu></table>
  • <var id="ohw05"></var>
  • <code id="ohw05"><cite id="ohw05"></cite></code>
    <label id="ohw05"></label>
    <var id="ohw05"></var>
  • 【翻譯】使用Visual Studio創建Asp.Net Core MVC (一)

    This tutorial will teach you the basics of building an ASP.NET Core MVC web app using Visual Studio 2015.

    在這個范例里,我們將使用Visual Studio 2015創建基本的Asp.Net Core MVC網站。

    安裝Visual Studio和.Net Core


    From the Visual Studio Start page, tap New Project.

    在Visual Studio 起始頁面,點擊New Project

    Alternatively, you can use the menus to create a new project. Tap File > New > Project.

    你也可以通過菜單創建新項目。點擊File > New Project

    Complete the New Project dialog:

    在New Project對話框完成以下操作:

    • 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 match.)
    • 項目取名:MvcMove(當你復制代碼時,這個項目名稱很重要,它跟命名空間相匹配)
    • Tap OK
    • 點擊OK

    Complete the New ASP.NET Core Web Application - MvcMovie dialog:

    在New Asp.Net Core Web Application –MvcMovie對話框完成以下操作:

    • Tap Web Application
    • 點擊Web Application
    • Clear Host in the cloud
    • 不勾選Host in the cloud
    • Tap OK.
    • 點擊OK

    Visual Studio used a default template for the MVC project you just created, so you have a working app right now by entering a project name and selecting a few options. This is a simple "Hello World!" 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.

    Visual Studio會根據默認模板創建MVC項目,你只要輸入一個項目名和選擇幾個選項就能創建。這是一個Hello World的項目,一個好的開始!點擊F5debug模式應用或者Ctrl+F5非Debug模式運行。

    • Visual Studio starts IIS Express and runs your app. Notice that the address bar shows localhost:port# and not something like example.com. That's because localhost always points to your own local computer, which in this case is running the app you just created. When Visual Studio creates a web project, a random port is used for the web server. In the image above, the port number is 1234. When you run the app, you'll see a different port number.
    • Visual Studio將開啟IIS Express運行你的應用。注意瀏覽器地址欄顯示的是localhost:端口號而不是example.com,這是因為這種情況下運行剛創建的應用,localhost總是指向自己的電腦。當Visual Studio創建了一個web項目后,它將為web服務器隨機一個端口號。以下圖片上,顯示的是1234端口,當你自己運行的時候,你看到的將是一個不同的端口號。
    • 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.
    • 使用Ctrl+F5(非Debug模式)運行應用,允許你在更改代碼,保存文件后,使用刷新頁面就能看到你的改變。許多開發者都喜歡用non-debug模式快速運行應用和查看更改。
    • You can launch the app in debug or non-debug mode from the Debug menu item:
    • 你可以通過Debug菜單運行Debug和non-debug模式:

    • You can debug the app by tapping the IIS Express button
    • 你也可以點擊IIS Express按鈕運行Debug模式

    The default template gives you working Home, About and Contact links. The browser image above doesn't show these links. 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.


    In the next part of this tutorial, we'll learn about MVC and start writing some code.




    posted @ 2017-01-16 10:40  James.Ying  閱讀(592)  評論(0編輯  收藏  舉報