Site stopped working in asp.net System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to

前端 未结 9 1510
盖世英雄少女心
盖世英雄少女心 2021-01-30 12:17

I have a problem like this on server

[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration

9条回答
  •  广开言路
    2021-01-30 12:57

    In the root Web.config make sure assemblyBinding contains the proper version for the assembly "System.Web.WebPages.Razor" and "System.Web.Mvc". Check for their actual existence as well as my "System.Web.WebPages.Razor" assembly tag was missing causing the error. I had my assembly versions set to 3.0 and 5.0 respectively in the time of this writing with full NuGet updates. Code should look something like below. The publicKeyToken will stay the same between the versions. Cheers!

    
      
      
            
            
      
    
      
        
        
      
    
    
    

提交回复
热议问题