我使用MVC 5.1技术制作了ASP.NET应用程序,并尝试将其部署到Winhost服务器上。 当我去我的网站,我得到以下错误信息。
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)
版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.3400
修复:问题出现在根文件夹web.config文件和本地web.config中。 我们需要添加MVC组件。
<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>
如果你已经安装.Net 4.5,那么这个post可能会给你正确的答案。 只需复制/发布所需的程序集到bin文件夹。 据Phil Haack几年前写的这篇文章 ,据我所知还是有效的。