Recently, the company started a new project using Asp.net mvc3, ASP. net4.0, and IIS6. Because IIS6 does not support paths without extension. So I thought of using URL rewriting.
The idea is as follows: add in IIS. the MVC extension is mapped to c: \ windows \ Microsoft. net \ framework \ v4.0.30319/aspnet_isapi.dll, you can use/home. MVC/index path, and then rewrite with URL
Rewriterule ^/home/index/$/home. MVC/index/[I, L, u]
This solves the above problems. However, the Error 404 is always displayed in practice.
The reason is as follows:
ASP. net 4.0 registers an ISAPI filter in IIS6, called "aspnet_filter.dll" during installation. The ISAPI filter is executed before the ISAPI processing program, it will add a string of characters "/eurl after all URLs without a suffix. axd/GUID ", Asp. net 4.0 will also add a request ing rule "*. axd ", ing to aspnet_isapi.dll. In this case, add "/eurl" to all URLs without a suffix. the axd/GUID will be changed to a tape. *. axd ing rules for ASP.. Net processing channel. Go to ASP. net channel, Asp. net handler will delete "/eurl. axd/GUID "to restore it to the original situation without a suffix, and will not affect subsequent request processing. In this case, all requests without a suffix enter ASP. net processing channel, by default, Asp. net4.0 global web. defaulthttphandler is configured in config to receive URL requests without a suffix, but we can also change the default handler (such as ASP.. Net MVC handler) to process URL requests without a suffix.
ASP. NET 4.0 in IIS6 native support URL requests without extension names
Solution: Remove aspnet_filter.dll.
Http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes#0.1__Toc256770153
If it is not practical to remap the web site to ASP. NET 2.0 or to change the location of a virtual directory, explicitly disable extensionless URL Processing in ASP. net 4. use the following procedure:
- In the Windows registry, open the following node:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0
- Create a newDWORDValue namedEnableextensionlessurls.
- SetEnableextensionlessurlsTo 0. This disables extensionless URL behavior.
- Save the registry value and close the registry editor.
- RunIisresetCommand-line tool, which causes IIS to read the new registry value.