Asp. netmvc5

Source: Internet
Author: User

Asp. netmvc5

Environment: VS2013 + MVC5 + IIS EXPRESS

Problem: If you migrate from Asp.net Web to MVC, you may encounter a needMake the original link (such as http: // localhost: 12345/old/library.html) accessible, and locate the original link to the new ActionBy default, MVC does not route the html suffix and directly gives you a 404 error (not found)

Solution: add in web. config

<System. webServer>
<Modules runAllManagedModulesForAllRequests = "true"/>
</System. webServer>

Best:

Thanks for the cloudification solution:

We do not recommend that you set runAllManagedModulesForAllRequests = "true"
This will increase the traffic request.
Set this way
<Handlers>
<Add name = "html_PageHandlerFactory" path = "*. html "verb =" * "type =" System. web. UI. pageHandlerFactory "resourceType =" Unspecified "preCondition =" integratedMode "/>
</Handlers> This is really useful! When I use <modules runAllManagedModulesForAllRequests = "true"/>, I find that the custom route inherited from RouteBase will be executed once more. Why, this should be the added traffic request!

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.