005. Getting started with ASP. NET Core MVC and Visual Studio, 005. gettingmvc
Getting started with ASP. NET Core MVC and Visual Studio
VS getting started with asp.net core mvc development
2-minute reading duration
Content
1. Install Visual Studio and. NET Core
Install VS and. NET Core
2. Create a web app
Create a web application
By Rick Anderson
This tutorial will teach you the basics of building an ASP. NET Core MVC web app using Visual Studio 2017.
This tutorial will teach you how to use VS2017 to create a basic asp.net core mvc application
There are 3 versions of this tutorial:
In addition, there are three other versions of tutorials (by yourself ~) :
- 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
Install vs and. net core
Install Visual Studio Community 2017. Select the Community download. Skip this step if you have Visual Studio 2017 installed.
Install vs 2017 community edition. Select Community version download. Skip this step if you have already installed it.
- Visual maxcompute 2017 Home page installer
Run the installer and select the following workloads:
Run the installation package and select the following items:
- ASP. NET and web development(UnderWeb & Cloud)
Environment 1 to be checked
- . NET Core cross-platform development(UnderOther Toolsets)
Environment 2 to be checked
Create a web app
Create a web application
From Visual Studio, selectFile> New> Project.
SelectFile> New> ProjectMenu, new.
CompleteNew ProjectDialog:
Complete the new project dialog box:
- In the left pane, tap. NET Core
In the left pane, click. net core.
- In the center pane, tapASP. NET Core Web Application (. NET Core)
In the middle pane, click 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
Name the project MvcMovie
Match .)
Click OK
CompleteNew ASP. NET Core Web Application (. NET Core)-MvcMovieDialog:
CompleteNew ASP. NET Core Web Application (. NET Core)-MvcMovieDialog Box:
- In the version selector drop-down box tapASP. NET Core 1.1
Select ASP. NET Core 1.1 in the version selection drop-down box
Click Web Application
- Keep the defaultNo Authentication
Retain the default No Authentication option
ClickOK
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 uses a default Project template. After you enter the project name and select a few options, you will have a web application that can work normally.
Name and selecting a few options. This is a simple starter project, and it's a good place to start,
This is a simple entry-level project and a good start point,
TapF5To run the app in debug mode orCtrl-F5In non-debug mode.
Click F5 to start the program in debug mode, or press ctrl + F5 to run the program in non-debug mode.
- Visual Studio starts IIS Express and runs your app. Notice that the address bar shows localhost: port # and not something
VS start iis express to run your app. Note that the address bar of the browser displays ip + port instead of common domain names.
Like example.com. That's because localhost is the standard hostname for your local computer. When Visual Studio creates
This is because localhost is your standard host name. When VS creates a new web project,
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,
A random port is selected by the web server. In, the port is 5000. When you run this app,
You'll see a different port number.
You may see a different port.
- Launching the appCtrl + F5(Non-debug mode) allows you to make code changes, save the file, refresh the browser, and
Start the application in non-debug mode. This allows you to make code changes, save files, refresh the browser, and
See the code changes. developers prefer to use non-debug mode to quickly launch the app and view changes.
View changes. Many developers prefer to use non-debug mode to quickly start the application and view changes.
- You can launch the app in debug or non-debug mode fromDebugMenu item:
You canDebugStart your app in debug or non-debug mode:
- You can debug the app by tappingIIS ExpressButton
You can clickIIS ExpressButton to start the debugging program
The default template gives you workingHome, AboutAndContactLinks. The browser image above doesn't show these links.
The default template providesHome, AboutAndContactThree Links and pages. These links are not displayed in the browser.
Depending on the size of your browser, you might need to click the navigation icon to show them.
Because it depends on the width of your browser, you may need to click the navigation icon to display them.
If you were running in debug mode, tapShift-F5To stop debugging.
If you are running in debug mode, clickShift-F5You can stop debugging.
In the next part of this tutorial, we'll learn about MVC and start writing some code.
In the next tutorial, we will begin to learn about mvc and how to start writing some code.
Mon
Wednesday