This tutorial uses Visual Studio 2013 to teach you how to build an ASP. NET MVC5 Web application. The C # source code project supporting this tutorial can be downloaded at the following URL: C # source code link. For more information, see Building the Chapter Downloads to compile the source code and configure the database.
In the source code project in this tutorial, you can run the MVC 5 Application in Visual Studio. You can also deploy Web applications to a hosting service provider. Microsoft provides free web hosting for up to 10 websites and free Windows Azure trial accounts. This tutorial is written by Scott Guthrie (twitter @ scottgu), Scott Hanselman (twitter: @ shanselman), and Rick Anderson (@ RickAndMSFT, translated by the grape city control team Sina Weibo @ grape city control ).
Getting started
Run Visual Studio Express 2013 for Web or Visual Studio 2013 to start the instance.
Visual Studio is an integrated IDE development environment. Just like you use Microsoft Word to write documents, you can use the integrated development environment IDE) to create an application. Different options are displayed in the top toolbar of Visual Studio for your use. There is also a menu in IDE that provides another way to execute tasks. For example"Start"Page, select"Create a project", You can use this menu, and then select"File">"Create a project")
650) this. width = 650; "style =" border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; "title =" clip_image002 "border =" 0 "alt =" clip_image002 "src =" http://www.bkjia.com/uploads/allimg/131229/12300125Y-0.gif "width =" 440 "height =" 484 "/>
Create your first MVC 5 Application
ClickCreate a project, SelectVisual C #And then selectWebAnd then selectASP. NET Web Application. Name your project as "MvcMovie", and then clickOK.
650) this. width = 650; "style =" border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; "title =" clip_image004 "border =" 0 "alt =" clip_image004 "src =" http://www.bkjia.com/uploads/allimg/131229/12300113D-1.gif "width =" 395 "height =" 484 "/>
InNew ASP. NET ProjectDialog box, selectMVC TemplateAnd then clickOK.
650) this. width = 650; "style =" border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; "title =" clip_image006 "border =" 0 "alt =" clip_image006 "src =" http://www.bkjia.com/uploads/allimg/131229/1230015263-2.gif "width =" 644 "height =" 452 "/>
The ASP. net mvc project created in Visual Studio uses the default template, so you do not need to do anything in the current project! This is a simple "Hello World! "Project, and this is also a good place for you to start the" MvcMovie "project ..
650) this. width = 650; "style =" border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; "title =" clip_image008 "border =" 0 "alt =" clip_image008 "src =" http://www.bkjia.com/uploads/allimg/131229/1230014307-3.gif "width =" 436 "height =" 484 "/>
Press the keyboard shortcut key F5 to start debugging. F5 enables Visual Studio to start IIS Express and run Web applications. Visual Studio then starts the browser and opens the main page of the application. Note that localhost: port # is displayed in the address bar of the browser instead of the address like example.com. This is because localhost is always resolved to your local computer. In this case, this is the application you just created. When Visual Studio runs a Web project, a Web service with a random port is used. In the image below, the port number is 1234. When you run the application, you may see a different port number.
650) this. width = 650; "style =" border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; "title =" clip_image010 "border =" 0 "alt =" clip_image010 "src =" http://www.bkjia.com/uploads/allimg/131229/1230015495-4.gif "width =" 506 "height =" 484 "/>
On the right side of the default template page, the "Home", "About", and "Contact" pages are provided. The following shows no connection between "Home", "About (About)", and "Contact. This depends on the size of your browser form. You can click the navigation icon in the upper right corner to view these links.
650) this. width = 650; "style =" border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; "title =" clip_image012 "border =" 0 "alt =" clip_image012 "src =" http://www.bkjia.com/uploads/allimg/131229/1230012420-5.gif "width =" 644 "height =" 453 "/>
650) this. width = 650; "style =" border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; "title =" clip_image014 "border =" 0 "alt =" clip_image014 "src =" http://www.bkjia.com/uploads/allimg/131229/12300124S-6.gif "width =" 644 "height =" 453 "/>
The ASP. Net MVC application created by the default template also provides the registration and logon functions. The next step is to modify the default application and learn about ASP. net mvc. Close the browser and let's modify some source code.
Address: http://www.asp.net/mvc/tutorials/mvc-5/introduction/getting-started