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

前端 未结 9 1334
盖世英雄少女心
盖世英雄少女心 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:38

    My case was upgrading from mvc4 to mvc5.

    I made sure my references were in sync (with a newly created mvc5 app), updated the web.config file accordingly and it still didn't work. It finally worked when i changed my web.config file (INSIDE THE VIEWS directory) from:

    
      

    To this:

    
      

    REMEMBER: stop iis (express or native), clean solution, build and Run.

提交回复
热议问题