Could not load type 'System.Web.Mvc.ViewPage<dynamic>' in asp.net mvc2 after publishing the website
I am using asp.net mvc2 and the project is running very well from visual studio, but when I published the project shows t开发者_JAVA百科his error. Could not load type 'System.Web.Mvc.ViewPage'
thanks
Thanks Darin I found the solution. I have to add this
<pages
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
in my web.config
You should make sure that the application pool in the web server is configured to use the CLR 4.0:
I faced the same problem while debugging my asp.net mvc 2 project with VS 2010 Ultimate and I finally had to add the 3 parameters pageParserFilterType
, pageBaseType
& userControlBaseType
to the page attributre in the web.config to get things working.
Mazen's answer also can solve the similar exception for the environment: MVC3, Framework4 and ASP.NET WebForms & MVC together in one project. Thank you guys!
In my case I had deployed an MVC3 app to our QA environment with a new Area, and got a similar error. We use WIX, and in my case I had forgotten to add the web.config file in the area/.../View folder.
Added the "web.config" to the Wix project and all worked fine.
精彩评论