Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expression of type 'System.Web.Mvc.MvcWebRazorHostFactory' cannot be used for return type 'System.Web.WebPages.Razor.WebRazorHostFactory'

I am getting this error when I try to run a project that I took over.

I assume I have a problem in my web.config, but I don't know what to look for.

Expression of type 'System.Web.Mvc.MvcWebRazorHostFactory' cannot be used for return type 'System.Web.WebPages.Razor.WebRazorHostFactory'

Any suggestions on the same are highly appreciated.

like image 286
Dave Avatar asked Mar 25 '13 14:03

Dave


2 Answers

Try to replace line in Web.Config

<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 

to

<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 

(set MvcWebRazorHostFactory to version 4.0.0.0)

like image 125
menkow Avatar answered Sep 29 '22 22:09

menkow


Set MvcWebRazorHostFactory to version 5.0.0.0 in ALL Views/web.config Under

<system.web.webPages.razor>     <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
like image 27
user2009677 Avatar answered Sep 29 '22 20:09

user2009677