Deploying ASP.net MVC applications under IIS6

Source: Internet
Author: User
Tags add iis net resource access

Typically, when you deploy a asp.net MVC application under IIS6, you set up the ISAPI processing of all requests to asp.net. MVC is based on ASP.net, the framework defaults to any request will first check the physical path exists physical files, if there is not through the MVC routing mechanism, otherwise walk by.

Therefore, if you do not consider controlling static resource permissions, you can set up static resources that do not pass through the ASP.net ISAPI, but are handled directly by IIS, which improves performance in this way. This article revolves around this topic, detailed the deployment process.

0. In the design of the MVC site, the static resources are unified in a folder, the proposed directory structure using lowercase letters

1. Publish the Web application to a path (abbreviated) (Incidentally, the MVC2 function is weaker than the MVC3, with few components, SYSTEM.WEB.MVC can be deployed directly, but MVC3 because of the increase in functionality, and the introduction of the Razor engine, the number of dependent components, it is recommended that the deployment of the direct installation of MVC3)

2. Create a Web site (abbreviated)

3. Right-click the Web site you created, select Properties, and switch to the home directory page

4. Click Configuration, wildcard application maps, click Insert, add C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_ Isapi.dll, uncheck the Verify that file EXISTSG. (If you use MVC2, you can go down to 2.0 to find this DLL.) Removing the validation of static files here is critical, which allows ASP.net to process all requests.

5. Click OK

6. Allow ASP.net 4.0 extensions

The 7.content directory is a static resource-placed directory where requests are processed directly by IIS to improve performance. Right-click Content, properties

8. Click Create, then click Configuration, remove wildcard application maps under the content. Click OK. This makes use of a bug in IIS, sets the directory to virtual directories, deletes the wildcard application maps settings, so the request for this virtual directory is handled directly by IIS.

9. Click Remove again to restore the virtual directory to the normal directory. So only the files in this directory will be "Blessed" by IIS.

10. Set AppPool permissions. Click on the AppPool properties used by the site to switch to identity and select local System. This is a lazy setup method to avoid the fact that the application itself has insufficient access to the system

11. Set Anonymous access permissions. Right-click the site and select permissions. Click Add ... to enter iusr_xxx (XXX is the machine name) in the pop-up dialog box.

Click OK to add an Internet Guest account and leave the default read-only permission.

12. Finally note that if you are installing. NET 4.0 for the first time, do not forget to register

In an in-depth understanding of asp.net mvc (2), the routing mechanism of the MVC framework is discussed, which mentions that "you can set routecollection Routeexistingfiles to True so that the route does not match the static file (note that true is not matched, This name and strange). "So we can set this so that MVC does not check for static files, which can improve performance." The final request will be serve as shown below



Related Article

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.