I encountered the following problems when I was a beginner at MVC. I am posting them to share with you!
I. How to debug the MVC Program
1) modify the web. config, in the web. <add Assembly = "system. web. MVC, version = 2.0.0.0, culture = neutral, publickeytoken = 31bf3856ad364e35 "/>, delete or comment out this line <! -- <Add Assembly = "system. Web. MVC, version = 2.0.0.0, culture = neutral, publickeytoken = 31bf3856ad364e35"/> -->
2) The web. pageparserfiltertype = "system. web. MVC. viewtypeparserfilter, system. web. MVC, version = 2.0.0.0, culture = neutral, publickeytoken = 31bf3856ad364e35 "changed to pageparserfiltertype =" system. web. MVC. viewtypeparserfilter, system. web. MVC, version = 2.0.0.0, culture = neutral, publickeytoken = NULL"
3) download source code, Source Code address: http://www.microsoft.com/downloads/details.aspx? Familyid = c9ba1fe1-3ba8-439a-9e21-def90a8615a9 & displaylang = en
4) Compile the source code to generate relevant dynamic libraries.
5) remove system. Web. MVC references from the MVC project.
6) Add the system. Web. MVC dynamic library generated by compiling source code in the MVC project.
7) debug the program and learn about MVC. Everything is OK.
2. Deploy the MVC program on IIS 5.1
1) create a virtual directory for the MVC Project
2) Click Properties> virtual directory> configuration options.
3) Add the extension. * ing file. The executable file path is C:/Windows/Microsoft. net/framework/v2.0.50727/aspnet_isapi.dll, select the check box before "Script Engine", and remove the check box before "check whether a file exists.
4) deployment is complete!
Added the suffix of the Three-character MVC program: .html or. sthml.
1) Find the global. asax file in the project.
2) find routes. maproute (
"Default", // route name
"{Controller}/{action}/{ID}", // URL with Parameters
New {controller = "home", Action = "Index", id = ""} // parameter defaults
);
3) change to: routes. maproute (
"Default", // route name
"{Controller}/{action}. Html/{ID} ", // URL with Parameters
New {controller = "home", Action = "Index", id = ""} // parameter defaults
);
Bold in red.
4. If there are multiple tokens, modify them once again, and add .html after the specified actiontag.
5) test, you can see that all your web pages are suffixed with. html.