Objective
This tutorial will explain the basics of using Microsoft's Visual Studio Express 2012 or Visual Web Developer Express Service Pack to build a asp.net MVC4 Web application 。 We recommend that you use Visual Studio 2012, and you will no longer need to install any components to complete this tutorial. If you are using Visual Studio 2010, you must install the following components. You can install all of the required components by clicking on the link below:
Visual Studio Web Developer Express SP1 Prerequisites
WPI installer for ASP.net MVC 4
LocalDB
Ssdt
If you are using Visual Studio 2010 instead of Visual Web Developer 2010, you will need to install WPI installer for ASP.net MVC 4 and Visual Studio Prerequisit Es
The C # sample source code for this article is a Visual Web Developer Project: Download the C # sample source code for this article.
What kind of application will this example build?
You will implement a simple movie list application that will support the ability to create, edit, search, and select a movie list from the database. Here are two screenshots of the application that you will build. It includes displaying a list of movies selected from the database:
The application also allows you to add, edit, and delete movies, as well as display the details of a single record. All user data entry scenarios contain data validation logic to ensure that the data stored in the database is correct.
Entry
Run Visual Studio Express 2012 or Visual Web Developer Express to start this example, most of which use Visual Studio Express 2012 screenshots, and you can Learn to complete this tutorial using Visual Studio 2010/sp1,visual Studio Express 2012 or Visual Web Developer Express 2012,visual. From the Start page, select New Project.
Visual Studio is an IDE integrated development environment. Just as you use Microsoft Word to write a document, you can use the Integrated development environment (IDE) to create an application. Various options are displayed in a top toolbar in Visual Studio for you to use. There is also a menu in the IDE that provides another way to perform a task. (For example, you can select New project from the Start page, you can use the menu, and then choose File > New project)
Create your first application
You can use Visual Basic or C # as your programming language to create your application. Please select Visual C # on the left and select ASP.net MVC 4 Web application. Name your project "Mvcmovie", and then click OK.
In the new ASP.net MVC 4 Project dialog box, select an Internet application. Use Razor as the default view engine.
Click OK. The ASP.net MVC project that Visual Studio just created uses the default template, so you don't have to do anything in the current project! This is a simple "Hello world!" "Works, and this is also a good place for you to start the" Mvcmovie "project.
From the Debug menu, select Start Debugging.
Note that you can also use the keyboard shortcut key F5 to start debugging.
F5 enables Visual Studio to start IIS Express and run the Web application. Visual Studio then launches the browser and opens the application's main page. Note that localhost is displayed in the browser's address bar instead of an address like example.com. This is because localhost is always resolved to be your own local computer, in which case this is exactly the application you have just built. When Visual Studio runs a Web project, it uses a Web service with a random port. In the picture below, the port number is 41788. When you run the application, you may see a different port number.
On the right side of the default template page, you are provided with home, about (about), and contact pages. It also provides registration and login features, and provides links to Facebook and Twitter. The next step is to modify this default application and learn some knowledge about asp.net mvc. Close the browser, let's change some of the source code.