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:

除此之外,还有其它三个版本的教程(自己翻译~):

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 社区版。选择社区版下载。如果你已安装过可以跳过这个步骤。

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.)

  • Tap OK

点击 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 选项

  • Tap Web Application

点击 Web Application

  • Keep the default No Authentication

保持默认的 No Authentication 选择

  • Tap OK.

点击 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 入门】的更多相关文章

  1. Visual Studio 2015 开发 ASP.NET 5

    在以往微软发布或更新 Visual Studio 版本时,我们开发 ASP.NET 应用程序,带给我们的变化其实并不是很大,或者说你根本就感受不到变化,你感受到的只是下载安装了几个 G 的 Updat ...

  2. Visual Studio 2015 开发 ASP.NET 5 有何变化?

    本篇博文目录: ASP.NET 5 模版 ASP.NET 5 目录结构 前端管理工具 无编译开发 Microsoft Git Provider 智能感知和错误信息 Smart Unit Testing ...

  3. Visual Studio 2015 开发 ASP.NET 5 有何变化?(转)

    出处:http://www.cnblogs.com/xishuai/p/visual-studio-2015-preview-asp-net-5-change.html 本篇博文目录: ASP.NET ...

  4. Mac上使用Visual Studio Code开发/调试.NET Core代码

    Mac上使用Visual Studio Code开发/调试.NET Core代码 .Net Core 1.0终于发布了,Core的一大卖点就是跨平台.这个跨平台不只是跨平台运行,而且可以跨平台开发.今 ...

  5. 使用Visual Studio Code开发Asp.Net Core WebApi学习笔记(一)-- 起步

    本文记录了在Windows环境下安装Visual Studio Code开发工具..Net Core 1.0 SDK和开发一个简单的Web-Demo网站的全过程. 一.安装Visual Studio ...

  6. 使用Visual Studio Code开发Asp.Net Core WebApi学习笔记(八)-- 多环境开发

    本篇将演示Asp.Net Core如何在多环境下进行开发适配. 在一个正规的开发流程里,软件开发部署将要经过三个阶段:开发.测试.上线,对应了三个环境:开发.测试.生产.在不同的环境里,需要编写不同的 ...

  7. 使用Visual Studio Code开发Asp.Net Core WebApi学习笔记(五)-- Filter

    在上一篇里,介绍了中间件的相关内容和使用方法.本篇将介绍Asp.Net Core MVC框架的过滤器的相关内容和使用方法,并简单说明一下与中间件的区别. 第一部分.MVC框架内置过滤器 下图展示了As ...

  8. 使用Visual Studio Code开发Asp.Net Core WebApi学习笔记(十)-- 发布(Windows)

    本篇将在这个系列演示的例子上继续记录Asp.Net Core在Windows上发布的过程. Asp.Net Core在Windows上可以采用两种运行方式.一种是自托管运行,另一种是发布到IIS托管运 ...

  9. [转]使用Visual Studio Code开发Asp.Net Core WebApi学习笔记(三)-- Logger

    本文转自:https://www.cnblogs.com/niklai/p/5662094.html 本篇是在上一篇的基础上添加日志功能,并记录NLog在Asp.Net Core里的使用方法. 第一部 ...

  10. 使用Visual Studio 2015 开发ASP.NET MVC 5 项目部署到Mono/Jexus

    最新的Mono 4.4已经支持运行asp.net mvc5项目,有的同学听了这句话就兴高采烈的拿起Visual Studio 2015创建了一个mvc 5的项目,然后部署到Mono上,浏览下发现一堆错 ...

随机推荐

  1. c语言项目开发流程二部曲

    一.在第一部曲中我们介绍了电子词典项目开发的前5步,下面继续我们的步伐. 6.函数接口设计,这一步不是一蹴而就的,在项目进行中得不断修改,下面是我电子词典项目接口. /**************函数 ...

  2. 通过demo学python

    链接 Github项目地址 软件安装包(pycharm.注册码.解析器等) Python 一切皆对象 Python 编码规范 The Python Standard Library The Pytho ...

  3. 使用babel编译es6

    起因:开发中慢慢的学习使用es6,但是JavaScript需要浏览器来解析,而不是所有浏览器都支持es6,所以为了兼容es6,需要第三方工具进行编译es6. 工具:node,gulp,gulp-bab ...

  4. 不知道Linux的mysql的root密码

    用了好几次了这个方法.记一下: 1.停止Mysql /etc/init.d/mysql stop 或者(根据安装配置的位置不同,而不同) /etc/init.d/mysqld stop 2.进入Mys ...

  5. OVS + dpdk 安装与实验环境配置

    ***DPDK datapath的OVS的安装与实验环境配置 首先肯定是DPDK的安装       0:安装必要的工具            make            gcc           ...

  6. Java文件流之练习

    1 )将"今年是反法西斯胜利70周年,举国欢庆,所以要放假啦" 字符串 使用文件字符输出流 写入到oldhappy.txt文件中,复写10000行, 要求换行 在文件的开头写入当前 ...

  7. jQuery杂项方法

    前面的话 杂项方法其实也是工具类方法,但由于其不是定义在jQuery构造函数上的方法,所以不能称为工具方法.本文将详细介绍jQuery中的杂项方法 数据操作 [data()] 该方法用于在匹配元素上存 ...

  8. 本地修改js代码并时时生效的解决办法

    js作为客户端语言(当然它也可以作服务端语言),非常强悍,一般情况下,我们都是在开发阶段不停的改,然后上线之后就作为稳定运行的代码. 然而有时候可能因为js写得有问题,导致上线后,某些功能无法使用,这 ...

  9. SonarQube Scanner的配置与使用简介

    一.下载 下载地址: https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.0.3.77 ...

  10. mysql之 mysql 5.6不停机主从搭建(一主一从)

    环境说明:版本 version 5.6.25-log 主库ip: 10.219.24.25从库ip:10.219.24.22os 版本: centos 6.7已安装热备软件:xtrabackup 防火 ...