For me commenting of "System.Web.Razor" from web config did not worked.Here are the things i did to resolve this.
Search your whole solution for references to MvcWebRazorHostFactory. you will find something like below in config file.
Change Version=4.0.0.0 to Version=5.0.0.0 and it will work.