MVC4.0 How to publish and deploy to IIS7.0 on the Web site

Source: Internet
Author: User

Vs2010,.net Framework for 4.0.30310, installation mvc4 need to upgrade VS2010 to VS2010 SP1 version, see diagram:

MVC4:

To test the need, create a controller HomeController in the project Zpg.specialsite and create a view index.cshtml, such as:

Edit the View page and add the Test text:

Next, publish the mvc4.0 site you just created, with the following steps:

1. Right-click the item you want to publish, and select "Publish ..." in the popup menu.

2. Set in the Publish Web dialog box, the profile name defaults to "Profile 1", which can be modified to the desired name for identification or not to change. Publish method Select File system, choose a folder at the target location to hold all files for the entire site that will be published, here I choose "d:/My Documents/Desktop/zpgweb" and then click the "Publish" button.

3. Click Post to generate the site files in the specified folder, publish successfully!

Next, deploy the successful site to iis7.0.

The steps are as follows:

1. Install the Microsoft. NET Framework 4.0 installation package ( the. NET Framework4.0 framework is used during web development );

2. Install ASP. NET MVC 4.0;

3. Set the "ASP. v4.0.0.30319" in "ISAPI and CGI restrictions" for IIS to allow, as shown in:

4. Publish the website in iis7.0, set the site home directory as "d:/My Documents/Desktop/zpgweb":

5. Set the . NET Framework version of the site (site "specialsite") application pool to 4.0.30196:

To add an application pool:

Set the added application pool to the site Specialsite

6. This completes the deployment of the mvc4.0 site in iis7.0.

Next, in the browser input http://localhost view the MVC4.0 project you just deployed, such as:

If the content appears, it indicates that iis7.0 successfully ran the project created by mvc4.0!!

Follow-up NOTE:

1. If the reader is using IIS that is installed after the. NET Framework is installed, IIS registration is required, start-run--cmd, open a command-line prompt, and enter the command as follows

C:/windows/microsoft.net/framework/v4.0.30319/aspnet_regiis.exe-i

Enter run, if the reader's server is a 64 system, then you need to use the command c:/windows/microsoft.net/framework64/v4.0.30319/aspnet_regiis.exe-i to run register IIS.

2. Since mvc4.0 has created the project, the default route is automatically configured as HomeController in the file "RouteConfig.cs" in the App_start folder under the project. The index method under the controller (ActionResult), so you do not need to configure the default document name in the site default document, the site will automatically find the default view file that needs to be displayed according to the MVC routing mechanism. such as:

MVC4.0 How to publish and deploy to IIS7.0 on the Web site

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.