views:

871

answers:

3

Hi, 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.

A: 

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

eKek0
Verified that System.Web.Mvc was in the GAC (C:\windows\assembly) which from the config file, should load those dll.
+1  A: 

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

griegs
+2  A: 

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.

It's /Views/web.config
stimpy77