나는 주변에 이러한 게시물이 많이 있다는 것을 이해하고 이번을 제외하고는 문제없이 이전에 이것들을 혼자 다루었습니다. Windows Azure에서 필요한 디버그 정보를 얻을 수없고 누군가가 나를 도울 수 있기를 바라기 때문입니다.
이 모든 작업은 내 로컬 환경, 디버그 및 릴리스에서 완벽하게 작동합니다.
이 오류가 발생합니다. 파일 또는 어셈블리 'Lib'또는 해당 종속성 중 하나를로드 할 수 없습니다. 잘못된 형식으로 프로그램을로드하려고했습니다.
Lib는 디렉토리에 존재하며 System.Drawing 및 mscorlib에만 의존합니다.
일반적으로 AppDomain.Current.AssemblyResolve
예외가 발생하면 예외를 첨부 하거나 확인합니다. 미리로드하는 동안 예외가 발생하기 때문에 Azure에서는이 작업을 수행 할 수 없습니다.
[BadImageFormatException: Could not load file or assembly 'Lib' 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 'Lib' 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) +736
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
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, Boolean& isRefAssemblyLoaded) +284
System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521
[HttpException (0x80004005): Could not load file or assembly 'Lib' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930568
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
이 문제를 가로 채기 위해 사용자 지정 어셈블리 로더를 재정의 / 생성하는 방법이 있습니까?
나는 완전한 손실에 처해 있습니다.
감사
스티브
나는 이것을 할 때 그것을 싫어한다. 하루 종일 노력했기 때문에 질문을 게시하고 10 분 후에 수정합니다.
그래서 많은 도움이 될 핵심 정보를 놓친 것 같습니다.
BadImageFormatException
이것은 (내가 말할 수있는 한) PLATFORM (아키텍처) 호환성 (x86, x64)에 문제가있을 때 발생합니다. 내 모든 프로젝트는 "모든 CPU"용으로 컴파일되었습니다 ( 프로젝트 속성> 빌드> 플랫폼 대상, VS2013에서 찾을 수 있음 ).
그러나 내 "Lib"프로젝트는 x64 전용으로 구축되었으며 Azure 웹 사이트는 32 비트 모드에서 실행되었으므로 64 비트 dll을로드 할 수 없습니다.
두 가지 옵션 :
"Lib"dll이 64 비트로 필요하기 때문에 옵션 2를 사용하지 않았습니다.
따라서 다른 사람이 이와 같은 것을 가지고있는 경우 향후 참조를 위해 다음을 확인하십시오.
다른 사람에게 도움이되기를 바랍니다.
감사
스티브
편집 : 다른 사람이이 문제가있을 수있는 향후 사람들을 위해 추가 할 유용한 정보가 있다면 그렇게하십시오.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다