Recently I learned asp.net mvc. I used to learn it before and didn't use it at that time. Now I have spent a day or two to summarize the problems I encountered:
1 When adding a master page, note the following:
<Asp: ContentPlaceHolder ID = "ContentPlaceHolder1" runat = "server">
</Asp: ContentPlaceHolder>
This ID is something I have encountered and worked on for a long time. When adding a view, the master page cannot be used. It turns out to be the ID. When you want to reference a master page, the ID must match.
2. Routing Problems During Multi-Level directories. In fact, this is not a routing problem. You need to set it in the Response parameters of the action in the Controller:
As follows:
Public ActionResult Index ()
{
Return View ("~ /Views/MVC/Index. aspx "); // return the specified directory level, which can be nested with multiple directories.
}
3. Post-Release IIS configuration
In IIS 7.0
Simply create a WebSite.
The error 500.19 may occur because vs is installed first and iis is installed later.
Solution: navigate to C: \ Windows \ System32 \ inetsrv in cmd.
Run appcmd unlock config-section: system. webServer/handlers
If you do not have the permission, assign the permission to the config folder in the directory.
In IIS 6.0
If asp.net mvc 1.0 is not installed on the server. web. mvc, System. web. routing, System. web. set the copy local attribute of the three dll directories of Abstractions to true. These three dll files must be released together with the Project dll.
There are two methods to deploy to IIS6.0
1. Add Extension
Change the routing mode in the Global. asax file of the project (add the. mvc extension)
Routes. MapRoute (
"Default ",
"{Controller}/{action}/{id }",
New {action = "Index", id = ""}
);
Routes. MapRoute (
"Root ",
"",
New {controller = "Home", action = "Index", id = ""
};
Add. mvc ing and WildCard Application Maps in iis
Iis Site --> properties ---> main directory --> Configuration --> ing --> insert
Find c: \ windows \ microsoft.net \ Framework \ v2.0. .. \ aspnet_isapi.dll, cancel "check whether the file exists" (do not select), --> OK
Finally, it can be run under IIS
(-:-:)