2015-04-09 3 views
2

У меня есть приложение ASP.NET MVC 4 Web Api с .NET Framework 4.0 и C#, развернутое на 64-разрядной версии Windows 7 Professional и IIS 7.0.Не удалось загрузить файл или сборку или одну из ее зависимостей. Была сделана попытка загрузить программу с неправильным форматом

Когда я запустить приложение, http://myHost/WebApi, я получаю это:

Can not load file or assembly 'AutomationMiddleware.Common' or one of its dependencies. An attempt was made to load a program with an incorrect format. Description: An unhandled exception when running the current web request. Review the stack trace for more information about the error and where it originated in the code. Exception Details: System.BadImageFormatException: Could not load file or assembly 'AutomationMiddleware.Common' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Source code error:

Has generated an uncontrolled 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.
Trail to load the assembly: The following information can be helpful to determine why no assembly 'AutomationMiddleware.Common' was loaded.

The administrator assemblies are loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable file c:\windows\system32\inetsrv\w3wp.exe --- Register of detailed errors.

=== Status information prior link ===
LOG: DisplayName = AutomationMiddleware.Common
(Partial)
AVS: partial link information for an assembly is provided:
AVS: Assembly Name:. AutomationMiddleware.Common | Domain Id: 2
AVS: A partial bond occurs when only provides part of the display name of the assembly.
AVS: This may lead to an incorrect load linker assembly.
AVS: It is recommended to provide a textual identity completely specified for assembly,
AVS: consisting of simple name, version, culture, and public key token.
AVS: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this problem.
LOG: AppBase = file: /// C:/inetpub/wwwroot/WebAPI /
LOG: Initial privatePath = C: \ inetpub \ wwwroot \ WebAPI \ bin Assembly Call: (Unknown). ===
LOG: This link begins in the context of default load.
LOG: Using the configuration file of the application: C: \ inetpub \ wwwroot \ WebAPI \ web.config
LOG: Using host configuration file: C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ aspnet.config
LOG: Using machine configuration file in C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ config \ machine.config.
LOG: The policy is not being applied to reference at this time (link private assembly, custom, partial, or location-based).
LOG: Attempting download of new URL file: /// C: /Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files /WebAPI/d5634960/b33de11c/AutomationMiddleware.Common.DLL.
LOG: Attempting download of new URL file: /// C: /Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/WebAPI/d5634960/b33de11c/AutomationMiddleware.Common/AutomationMiddleware.Common. DLL.
LOG: Attempting download of new URL file: /// C: /inetpub/wwwroot/WebApi/bin/AutomationMiddleware.Common.DLL.
ERR: Failed to complete the installation of assembly (hr = 0x8007000B). He ended the search.

Stack trace:

[BadImageFormatException: Could not load file or assembly 'AutomationMiddleware.Common' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17 System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122

[ConfigurationErrorsException: Could not load file or assembly 'AutomationMiddleware.Common' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +12495956
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +499 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +131 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +331
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +148
System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): Could not load file or assembly 'AutomationMiddleware.Common' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12617668 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12457285

Microsoft .NET Framework:4.0.30319; Versión ASP.NET:4.0.30319.34237

Я собрал все DLL с архитектурой x86, и ту же ошибку. С anyCPU и с той же ошибкой. И с x64 и с той же ошибкой.

AutomationMiddleware.Common - это сборка, которую я разработал. Все сборки являются моими, кроме nuget (Entity Framework, Json.net и т. Д.).

Любая идея?

ответ

3

Я добавлю это как сообщество wiki, чтобы помочь другим людям решить эту проблему.

Если у вас есть эта проблема, пожалуйста, проверьте этот ответ: https://stackoverflow.com/a/2926982/68571. Возможно, это поможет вам решить эту проблему.

0

Хм, похоже, что очень странно ошибка здесь:

ли вы искать код ошибки вы получили?

Error code 0x80004005

This problem may occur if a file that the Windows Product Activation (WPA) requires is damaged or missing. This behavior occurs if one or both of the following conditions are true:

  • A third-party backup utility or an antivirus program interferes with the installation of Windows XP.
  • A file that WPA requires is manually modified.

Может быть некоторые из внешних зависимостей необходимо обновить?

+0

Я тестировал одну и ту же установку на двух разных компьютерах и получаю ту же ошибку. Что вы подразумеваете под «Может быть, некоторые из внешних зависимостей необходимо обновить?»? – VansFannel

+1

Я решил свою проблему с этим ответом SO: http://stackoverflow.com/a/2926982/68571 – VansFannel

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

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