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

创建一个Web应用

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.

默认模板有HOME,About和Contact三个链接。下图因为浏览器问题你看不到这几个链接,你可以通过点击导航图标显示。

If you were running in debug mode, tap Shift-F5 to stop debugging.

如果你运行在Debug模式下,Shift+F5停止Debug。

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

在这个范例的下一章节,我们将如何编写MVC代码。

原文链接

https://docs.microsoft.com/zh-cn/aspnet/core/tutorials/first-mvc-app/start-mvc

【翻译】使用Visual Studio创建Asp.Net Core MVC (一)的更多相关文章

  1. ASP.NET Core 中文文档 第二章 指南(2)用 Visual Studio 和 ASP.NET Core MVC 创建首个 Web API

    原文:Building Your First Web API with ASP.NET Core MVC and Visual Studio 作者:Mike Wasson 和 Rick Anderso ...

  2. Working with Data » 使用Visual Studio开发ASP.NET Core MVC and Entity Framework Core初学者教程

    原文地址:https://docs.asp.net/en/latest/data/ef-mvc/intro.html The Contoso University sample web applica ...

  3. Visual Studio 2017 ASP.NET Core开发

    Visual Studio 2017 ASP.NET Core开发,Visual Studio 2017 已经内置ASP.NET Core 开发工具. 在选择.NET Core 功能安装以后就可以进行 ...

  4. 创建ASP.NET Core MVC应用程序(1)-添加Controller和View

    创建ASP.NET Core MVC应用程序(1)-添加Controller和View 参考文档:Getting started with ASP.NET Core MVC and Visual St ...

  5. 创建ASP.NET Core MVC应用程序(6)-添加验证

    创建ASP.NET Core MVC应用程序(6)-添加验证 DRY原则 DRY("Don't Repeat Yourself")是MVC的设计原则之一.ASP.NET MVC鼓励 ...

  6. 创建ASP.NET Core MVC应用程序(5)-添加查询功能 & 新字段

    创建ASP.NET Core MVC应用程序(5)-添加查询功能 & 新字段 添加查询功能 本文将实现通过Name查询用户信息. 首先更新GetAll方法以启用查询: public async ...

  7. 创建ASP.NET Core MVC应用程序(4)-添加CRUD动作方法和视图

    创建ASP.NET Core MVC应用程序(4)-添加CRUD动作方法和视图 创建CRUD动作方法及视图 参照VS自带的基架(Scaffold)系统-MVC Controller with view ...

  8. 创建ASP.NET Core MVC应用程序(3)-基于Entity Framework Core(Code First)创建MySQL数据库表

    创建ASP.NET Core MVC应用程序(3)-基于Entity Framework Core(Code First)创建MySQL数据库表 创建数据模型类(POCO类) 在Models文件夹下添 ...

  9. 创建ASP.NET Core MVC应用程序(2)-利用MySQL Connector NET连接到MySQL

    创建ASP.NET Core MVC应用程序(2)-利用MySQL Connector NET连接到MySQL 用惯.NET的研发人员都习惯性地使用SQLServer作为数据库.然而.NET Core ...

随机推荐

  1. FusionCharts导出图表常见问题(FAQ)汇总---FusionCharts常见问题大全

    在前面几篇文章中,我们介绍了FusionCharts生成Flash图表常见问题FAQ以及使用中的一些常见报错及调试/解决方法.本文继续介绍FusionCharts导出图表时的一些常见问题(FAQ). ...

  2. vc6 pbo 文件为空的解决方法

    使用Profile调试vc6应用程序的性能时,将生成pbo文件,今天在vc IDE中增加了命令行启动参数,导致profile无法生成pbo文件,进而无法生成性能报告. 解决方法: 去掉IDE中的命令行 ...

  3. ubuntu设置字体编码GBK和UTF-8

    http://www.xwuxin.com/?p=1155 http://zhidao.baidu.com/link?url=T6m7WDVOM1VBiUctkfkf1qO14lSMLhxg6MIRt ...

  4. Java枚举的3类语法

    一.最基本的用法 public enum TestEnum { IMG,TEXT,WORD } 使用时: TestEnum testEnum=TestEnum.WORD; System.out.pri ...

  5. Unity3d/2d手机游戏开发第二版 (金玺曾) 随书资源

    http://pan.baidu.com/s/1c0xpn4s Unity3d2d手机游戏开发配书资源文件.rar 1.36G 书上的链接坏掉了,我在论坛上面买了一份,放这分享给买了书找不到资源的同学 ...

  6. Tesseract-OCR使用记录

    Tesseract是一个开源的OCR(Optical Character Recognition,光学字符识别)引擎,可以识别多种格式的图像文件并将其转换成文本,目前已支持60多种语言(包括中文).  ...

  7. Amoeba详细介绍

    Amoeba的中文意思是变型虫 Amoeba是一个以MySQL为底层数据存储,并对应用提供MySQL协议接口的proxy.它集中地响应应用的请求,依据用户事先设置的规则,将SQL请求发送到特定的数据库 ...

  8. w3c学习总结1

    1.根据 HTML5 规范,在没有其他合适标签更合适时,才应该把 <b> 标签作为最后的选项.HTML5 规范声明:应该使用 <h1> - <h6> 来表示标题,使 ...

  9. Windows Azure Table Storage 解决 Guid 查询问题

    在使用 Windows Azure Table Storage 的 CloudTableClient 对Azure 进行数据查询时,会发现在自定义类的Guid类型始终无法去成功查询出数据,对比发现 G ...

  10. 类似java.lang.NoClassDefFoundError: org/jaxen/JaxenException解决方法

    在使用dom4j的xpath时出现java.lang.NoClassDefFoundError: org/jaxen/JaxenException的异常,原因是dom4j引用了jaxen jar包,而 ...