What is this error in an ASP.NET MVC 3 RTM project?

I am creating a new RTM MVC 3 project for the project and replacing the links for using ASP.NET MVC 3 Source Code

but when I run the project again, get this exception:

[A] System.Web.WebPages.Razor.Configuration.HostSection cannot be dropped [B] System.Web.WebPages.Razor.Configuration.HostSection. Type A is taken from "System.Web.WebPages.Razor, Version = 1.0.0.0, Culture = Neutral, PublicKeyToken = 31bf3856ad364e35 'in the" Default "context in the location" C: \ Windows \ Microsoft.Net \ assembly \ GAC_MSIL \ System .Web.WebPages.Razor \ v4.0_1.0.0.0__31bf3856ad364e35 \ System.Web.WebPages.Razor.dll. Type B is taken from "System.Web.WebPages.Razor, Version = 1.0.0.0, Culture = Neutral, PublicKeyToken = null 'in the" Default "context at" C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET Files \ root \ 2505c7ee \ 369315c5 \ assembly \ DL3 \ f7bae428 \ d03eeed8_85bbcb01 \ System.Web.WebPages.Razor.DLL ".

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it occurred in the code.

Source Error:

Line 106: internal static RazorWebSectionGroup GetRazorSection(string virtualPath) { Line 107: // Get the individual sections (we can only use GetSection in medium trust) and then reconstruct the section group Line 108: return new RazorWebSectionGroup() { Line 109: Host = (HostSection)WebConfigurationManager.GetSection(HostSection.SectionName, virtualPath), Line 110: Pages = (RazorPagesSection)WebConfigurationManager.GetSection(RazorPagesSection.SectionName, virtualPath) 

Source file: E: \ Greentour \ web pages \ SRC \ System.Web.WebPages.Razor \ WebRazorHostFactory.cs Line: 108

+14
asp.net-mvc-3
Jan 24 2018-11-11T00:
source share
4 answers

This error means that part of your application was compiled using your own copy of the source code as a link, and while it was running, it found the link assemblies in the GAC. Make sure you remove all references to the GACed version of the MVC 3 assembly. This includes a few things in your web.config files that use this public key token: 31bf3856ad364e35.

+13
Jan 24 '11 at 19:59
source share

I just encountered the same problem when updating my application, the problem was in the web.config file located in the views directory, I blindly copied it from the old application (my bad).

My solution, create a new MVC 4 application and copy the web.config file from the views directory to your application that has a problem.

Hope this helps

+13
Sep 14 '12 at 9:20
source share

Although the above topic was helpful. I couldn't get the job to work until I created the 'dummy' 'basic' MVC 4 application and then compared web.configs to find any changes.

0
Aug 01 2018-12-12T00:
source share

I did not fix this by deleting all the references to the 31bf3856ad364e35 public key assemblies, as this covers many irrelevant assemblies.

Instead, it should be fixed by updating all configuration links

  • System.Web.Mvc to 4
  • System.Web.WebPages to 2
  • System.Web.WebPages.Razor to 2

Be sure to update all web.configs, including those listed in View directories.

0
Mar 06 '15 at 1:04
source share



All Articles