2010-11-23 5 views
7

У меня есть это новое приложение MVC, которое я установил на Windows 2008 Server. И получите следующее сообщение, когда я запустил localhost.Не удалось загрузить файл или сборку «System.Web.Mvc» или одну из его зависимостей

Я проверил папку Bin и могу подтвердить, что существует System.Web.MVC. И версия файла, 2.0.50217.0

И в web.config я определил эту сборку,

Может ли один помочь? Смотрите сообщение об ошибке ниже:

---- ERROR MESSAGE ------------------------------

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=3.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=3.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() +332 
    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=3.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) +8950644 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256 




-------------------------------------------------------------------------------- 
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

ответ

7

не удалось загрузить файл или сборку «System.Web.Mvc, Version = 3.0.0.0, ...»

Ваше приложение использует MVC3, но в соответствии с вашим собственным комментарием, сервер имеет MVC2 (2.0. 50217.0).

12

У меня была эта проблема при развертывании на сервере, на котором запущен MVC2, файлы, которые необходимо будет включить в сборку:

Microsoft.Web.Infrastructure.dll 
System.Web.Helpers.dll 
System.Web.Mvc.dll 
System.Web.Razor.dll 
System.Web.WebPages.Deployment.dll 
System.Web.WebPages.dll 
System.Web.WebPages.Razor.dll 

Фил Хаак сделал хороший пост здесь (для того, как решить, если вы столкнулись с этой проблемой при развертывании)

http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx

+1

Я столкнулся с этим вопросом на Server 2012, что Ждут» t имеет .NET Framework 3.5 (который также включает в себя версии 2.0 и 3.0). Поэтому проверьте это тоже! – 2014-08-07 18:02:50

2

Если у вас есть права, чтобы сделать это, вы можете download и установить MVC3 на вашем веб-сервере.

0

Щелкните правой кнопкой мыши по System.Web.Mvc в своей справочной папке и убедитесь, что для локальной копии установлено значение true. Это должно добавить System.web.mvc в папку bin, и это должно устранить проблему.

5

Щелкните правой кнопкой мыши на Project -> Управление NuGet Пакеты для решения, чем обновить

Microsoft.AspNet.Mvc и Microsoft.Net.Compilers

Смежные вопросы

 Смежные вопросы