在Windows Server 2008 x64上部署网站时,我遇到了这个问题。我什么都不知道。任何人都可以帮助我吗?
Could not load file or assembly 'Interop.EDOfficeLib' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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.BadImageFormatException: Could not load file or assembly 'Interop.EDOfficeLib' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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 'Interop.EDOfficeLib' could not be loaded.
=== Pre-bind state information ===
LOG: User = IIS APPPOOL\DefaultAppPool
LOG: DisplayName = Interop.EDOfficeLib
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Interop.EDOfficeLib | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/TSDX 3.0.0/WebService/
LOG: Initial PrivatePath = C:\TSDX 3.0.0\WebService\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\TSDX 3.0.0\WebService\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/9d46c957/8adcacab/Interop.EDOfficeLib.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/9d46c957/8adcacab/Interop.EDOfficeLib/Interop.EDOfficeLib.DLL.
LOG: Attempting download of new URL file:///C:/TSDX 3.0.0/WebService/bin/Interop.EDOfficeLib.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'Interop.EDOfficeLib' 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, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192
System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +123
[ConfigurationErrorsException: Could not load file or assembly 'Interop.EDOfficeLib' 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) +11568160
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +485
System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +79
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +337
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1167
[HttpException (0x80004005): Could not load file or assembly 'Interop.EDOfficeLib' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11700896
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4869125
答案 0 :(得分:1)
您正在64位操作系统上运行为AnyCPU编写的应用程序,并且未为x64系统编译/可用一个或多个引用的程序集。
第一个解决方案是重新编译x86平台的应用程序
第二种解决方案是分发EDOfficeLib
答案 1 :(得分:1)
我必须补充一点,此外我的问题可以通过以下方式解决:应在应用程序池的“高级设置”面板上将Enable 32-Bit Applications
参数设置为True
。 (IIS管理器)。在这种情况下,我不需要重新编译。也许它会对某人有用。