I made ASP.NET application with MVC 5.1 technology and tried to deploy it on Winhost server. When I go to my web site, I get the following error message.
Could not load file or assembly 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.3400
FIXED: Problem was been in root folder web.config file and in local web.config too. We needed to add MVC assembly.
<system.web>
<trust level="Full"/>
<customErrors mode="Off"/>
<authentication mode="None"/>
<httpRuntime targetFramework="4.5" requestValidationMode="2.0" maxRequestLength="65536"/>
<compilation targetFramework="4.5" batch="true" numRecompilesBeforeAppRestart="250" optimizeCompilations="true" debug="true">
<assemblies>
<add assembly="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
</assemblies>
</compilation>
If you have .Net 4.5 already installed then this post might give you the right answer. Just copy/publish the needed assemblies to the bin folder. The article written years ago by Phil Haack is still valid as far as I know.
User contributions licensed under CC BY-SA 3.0