首页 新闻 会员 周边

MVC3部署在windows 2003的主机(虚拟主机)上报错

0
悬赏园豆:20 [已解决问题] 解决于 2014-05-15 16:44

Server Error in '/' Application.


 

Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

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. 

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Stack Trace: 

[FileLoadException: Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]

[FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=4.0.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)]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly 'System.Web.Mvc, Version=4.0.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)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +618
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +209
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +94
   System.Web.Compilation.BuildManager.CallPreStartInitMethods() +167
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +591

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Mvc, Version=4.0.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)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8961476
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258
Hing  。的主页 Hing 。 | 初学一级 | 园豆:2
提问于:2014-05-15 11:04
< >
分享
最佳答案
0

缺少了dll文件了吧。我发布mvc4项目时做过这些事:

1、以下dll属性里改成复制到本地。

System.Web.Abstractions
System.Web.ApplicationServices
System.Web.DynamicData
System.Web.Entity
System.Web.Extensions
System.Web.Helpers
System.Web.Routing
System.Web.Services
System.Web.WebPages

2、从 C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies 复制以下dll到网站的bin文件夹里:

System.Web.Razor.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.Razor.dll

收获园豆:20
赏音师 | 菜鸟二级 |园豆:221 | 2014-05-15 11:12

该有的文件都有 ...

Hing 。 | 园豆:2 (初学一级) | 2014-05-15 11:12

@Hing 。: The located assembly's manifest definition does not match the assembly reference.

你发布用的dll,跟你开发用的不同吧。

赏音师 | 园豆:221 (菜鸟二级) | 2014-05-15 11:19

@Badcode: 我在引用里边的DLL右击属性然后点了复制到本地,然后发布的,请问你Q多少 

Hing 。 | 园豆:2 (初学一级) | 2014-05-15 11:21

@Hing 。: 那我也不知道原因了,我们公司不给上qq。。。

赏音师 | 园豆:221 (菜鸟二级) | 2014-05-15 11:35

@Hing 。: 记下dll名,把用到的dll从项目里移除,重新添加下,项目上右键--清理,然后右键--重新生成。试试吧。。

赏音师 | 园豆:221 (菜鸟二级) | 2014-05-15 11:40
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册