title: Site stopped working in asp.net System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to
body: <p>I have a problem like this on server</p>
  
  <blockquote>
    <p>[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast
    to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A
    originates from 'System.Web.WebPages.Razor, Version=2.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context
    'Default' at location
    'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
    Type B originates from 'System.Web.WebPages.Razor, Version=1.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context
    'Default' at location
    'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.</p>
  </blockquote>
  
  <p>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 originated in the code. </p>
  
  <blockquote>
    <p>Exception Details: System.InvalidCastException:
    [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast
    to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A
    originates from 'System.Web.WebPages.Razor, Version=2.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context
    'Default' at location
    'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
    Type B originates from 'System.Web.WebPages.Razor, Version=1.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context
    'Default' at location
    'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.</p>
  </blockquote>
  
  <p>Source Error: </p>
  
  <p>I have installed MVC 3  on serer and on my computer. I have tried with replacing it with 15 days old codebase but the same problem exist.</p>
  
  <p>now I want to solve it. Do someone know how I can fix it.</p>