Link Address: http://www.th7.cn/Program/net/201403/183756.shtml
Recently in the study of MVC4, using VS2010, the development of the site in the release and deployment to the IIS7 process has encountered a lot of problems, now the process of the resolution is recorded for future reference, the whole process is mainly in the form of presentation
The installation of vs2010 and the installation of MVC4 are not listed in this record, primarily recording site publishing and the deployment of IIS
The version used is as follows:
IIS is 7.0:
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 the registered IIS.
2. Since mvc4.0 has created the project, the default route is automatically configured as the index method (ActionResult) under the HomeController controller in the file "RouteConfig.cs" in the App_start folder under the project. Therefore, you do not need to configure the default document name in the site default document, the site will automatically find the default need to display the view file according to the MVC routing mechanism. Such as:
For a long time without the introduction of these simple introductory, so take a moment to write, perhaps to some similar to my entry-level friends to help!! ' (*∩_∩*)
MVC4.0 How to publish and deploy to IIS7.0 on the Web site