简体   繁体   中英

Error running ASP.NET MVC on IIS 7

I have been trying to deploy my asp.net mvc site to IIS 7 and having a bit of an issue. Whenever I run the site, I get a "Could not load type 'System.Web.Mvc.ViewPage'.". When I try to access a page with a master page, I get a Could not load type 'System.Web.Mvc.MasterViewPage'" error. I tried using tracing rules in IIS 7 to narrow down on the issue with no anvil. On the bright side, when I run the site through the built-in visual studio webserver, the site runs just fine but not on IIS 7. Has any one run into this before or has any idea what could be causing this error. Thanks.

OK, so after playing around with this issue for a while. I finally fixed it. I was publishing to IIS 7 using visual studio deployment tools with copy 'only files needed to run this application". For some reason, using this publishing configuration doesn't copy all the files needed for mvc to run correctly. When I changed my publishing setting to copy " all project files", it worked. I am yet to actually discover whats was missing between the two publishing configuration for one to error out but wanted to post the solution now just in case someone runs into the same problem.

You need to include the mvc DLL's by opening your solution, opening the references folder, right clicking on each of them, get their properties and setting them to Copy Local = true.

system.web.mvc

system.web.routing

system.web.abstractions

those are the three i think

Did you deploy all the necessary assemblies? ViewPage and MasterViewPage are in the same assembly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM