Error: Inheritance security rules violated by type: 'System.Web.WebPages.Razor.WebPageRazorHost'

From my friend Claudio Redi's comment the solusion of this problem is:

Try removing the System.Web.Razor assembly binding in the web.config if present. http://forums.asp.net/t/1968686.aspx?Installed+Nuget+package+Razor+Engine+whole+system+stops


Go to Web.config and Search for the Assembly name="System.Web.Razor" and comment as follow.

 <!--<dependentAssembly>
    <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>-->

After Commenting save and run the project,it will work fine.