【翻译】使用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
- Install Visual Studio Community 2015. Select the Community download and the default installation. Skip this step if you have Visual Studio 2015 installed.
- 安装Visual Studio Community 2015。下载Community后默认安装,如果你已经安装可以跳过这步。
- Visual Studio 2015 Home page installer(Visual Studio 2015安装页)
- Install .NET Core + Visual Studio tooling
- 安装.NET Core + Visual Studio tooling
创建一个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 likeexample.com
. That's becauselocalhost
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
- 机器学习该如何入门
- dedecms建的网站如何去掉/index.html
- WPF ContextMenu的使用
- Json的序列化与反序列化以及乱入的k_BackingField
- 亚马逊面试题
- VisualStudio 怎么使用Visual Leak Detector
- Cannot find module 'socket.io'
- 【学术】独热编码如何在Python中排列数据?
- 比特币的私钥【区块链生存训练】
- Unity3D学习笔记第一课
- Extjs4处理后台json数据中日期和时间的方法
- 机器学习:Python测试线性可分性的方法
- Java 机器学习库Smile实战(一)SVM
- 交易Transaction【区块链生存训练】
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- 面试官带你学Android——面试中Handler 这些必备知识点你都知道吗?
- leetcode哈希表之前K个高频元素
- Kali之U盘启动加密与持久化存储制作流程
- Gentoo发行版系统基础使用记录
- Ubuntu-20.04-LTS桌面版与服务器版基础初始配置
- Snap容器基础入门使用
- zabbix入门学习
- 突击并发编程JUC系列-ReentrantReadWriteLock
- Qt音视频开发33-ffmpeg安卓版
- Vue.js|Nuxt仿制探探堆叠滑动|vue仿Tinder卡片效果
- Elasticsearch:透彻理解 Elasticsearch 中的 Bucket aggregation
- html+js开发模拟考试在线评分系统
- iOS音视频接入 - TRTC接入实时视频通话
- LRU缓存淘汰机制C++实现
- ant-design-vue运行时动态切换主题色