2013-05-31 3 views
2

Visual Studio 2012에서 만든 WCF 서비스를 실행하려고합니다.BadImageFormatException 예외

페이지 아래에 오류가 발생합니다.

> Exception Details: System.BadImageFormatException: Could not load file 
> or assembly 'dllname' or one of its dependencies. An attempt was made 
> to load a program with an incorrect format. 
> 
> -------------------------------------------------------------------------------- Assembly Load Trace: The following information can be helpful to 
> determine why the assembly 'dllname' could not be loaded. 
> 
> === Pre-bind state information === LOG: User = IIS APPPOOL\DefaultAppPool LOG: DisplayName = dllname (Partial) WRN: 
> Partial binding information was supplied for an assembly: WRN: 
> Assembly Name: dllname | 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:///D:/wwwroot/website/WebServices/ LOG: Initial PrivatePath = 
> D:\wwwroot\website\WebServices\bin Calling assembly : (Unknown). 
> === LOG: This bind starts in default load context. LOG: Using application configuration file: 
> D:\wwwroot\website\WebServices\web.config LOG: Using host 
> configuration file: 
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config LOG: Using 
> machine configuration file from 
> C:\Windows\Microsoft.NET\Framework\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/Framework/v4.0.30319/Temporary 
> ASP.NET Files/webservices/febcb7de/76686d13/dllname.DLL. LOG: 
> Attempting download of new URL 
> file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary 
> ASP.NET Files/webservices/febcb7de/76686d13/dllname/dllname.DLL. LOG: 
> Attempting download of new URL 
> file:///D:/wwwroot/website/WebServices/bin/dllname.DLL. ERR: Failed to 
> complete setup of assembly (hr = 0x8007000b). Probing terminated. 
> 
> -------------------------------------------------------------------------------- Stack Trace: 
> 
> [BadImageFormatException: Could not load file or assembly 'dllname' 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.nLoad(AssemblyName fileName, String 
> codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, 
> StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean 
> throwOnFileNotFound, Boolean forIntrospection, Boolean 
> suppressSecurityChecks) +34 
> System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName 
> assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, 
> StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean 
> throwOnFileNotFound, Boolean forIntrospection, Boolean 
> suppressSecurityChecks) +152 
> System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, 
> Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr 
> pPrivHostBinder, Boolean forIntrospection) +77 
> System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, 
> Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean 
> forIntrospection) +16 System.Reflection.Assembly.Load(String 
> assemblyString) +28 
> System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String 
> assemblyName, Boolean starDirective) +38 
> 
> [ConfigurationErrorsException: Could not load file or assembly 
> 'dllname' 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) +752 
> System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() 
> +218 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo 
> ai) +130 
> System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection 
> compConfig) +170 
> System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() 
> +91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String 
> preStartInitListPath) +258 
> System.Web.Compilation.BuildManager.ExecutePreAppStart() +135 
> System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager 
> appManager, IApplicationHost appHost, IConfigMapPathFactory 
> configMapPathFactory, HostingEnvironmentParameters hostingParameters, 
> PolicyLevel policyLevel, Exception appDomainCreationException) +516 
> 
> [HttpException (0x80004005): Could not load file or assembly 'dllname' 
> or one of its dependencies. An attempt was made to load a program with 
> an incorrect format.] 
> System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873784 
> System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) 
> +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest 
> wr, HttpContext context) +254 
> 
> 
> 
> -------------------------------------------------------------------------------- 

나는 그것에 대해 인터넷 검색 그리고 난 이미 것들을 몇 가지 시도했다. 1) "모든 CPU" 3) 임시 파일을 삭제, 재활용 응용 프로그램 풀과 같이 프로젝트 속성에서 응용 프로그램 풀 2) 제작 목표의 32 비트 응용 프로그램을 사용, 당신은 더 이상 제안이있는 경우 IIS 등

이 도와주세요 재설정합니다.

답변

3

32 비트 응용 프로그램 풀에 64 비트 어셈블리를로드하려고합니다. 나는 스택 트레이스에서 C:\Windows\Microsoft.NET\Framework\v4.0.30319\을 보았 기 때문에 이것을 말하고있다. 64 비트 응용 프로그램 풀인 경우 Framework64을 사용합니다. "32 비트 활성화"를 비활성화하고 다시 시도하십시오.

+0

해제하면 "파일 또는 어셈블리 'dllname'또는 해당 종속성 중 하나를로드 할 수 없습니다. 위치한 어셈블리의 매니페스트 정의가 어셈블리 참조와 일치하지 않습니다." – Jeevan

+1

나는 위에서 언급 한 문제를 모든 csproj에서 x86으로 플랫폼 타겟을 만들고 32 비트 응용 프로그램 풀을 활성화하여 해결했습니다. 감사합니다 – Jeevan

+0

이 동일한 문제가 있었지만 32 비트 어셈블리를 64 비트 응용 프로그램 풀로로드하려고했습니다. 풀에 대한 고급 설정에서 "32 비트 응용 프로그램 활성화"를 True로 설정하면 해결되었습니다. –

관련 문제