Zielplattform und 'Konnte nicht geladen, Datei oder assembly' Fehler
Ich habe einen Win-Forms-Anwendung für 64-bit-Plattform (es ist erforderlich, als es mit der 64-bit - Oracle.DataAccess
Bibliotheken).
Habe ich Hinzugefügt ASP.net forms-Anwendung, um diese Lösung, und ich möchte hinzufügen, die einen Verweis auf die WinForms-app auf die ASP.net app.
Meine WebApp auch auf 64-bit und richtig erstellt, aber wenn ich es laufen lasse bekomme ich:
'Konnte nicht geladen, Datei oder assembly '
Oracle.DataAccess
' oder eine Ihrer Abhängigkeiten'.
Ich auch sicher, dass die Oracle.DataAccess sind die neuen 64-bit-version.
Irgendwelche Ideen?
Der Winforms-Anwendung (das ist die Referenz zu Oracle.DataAccess) ausgeführt werden, die 100%, so dass mir sagt, vielleicht ist das problem auch nicht mit der dll-version.
Weitere Infos auf der folgenden Fehlermeldung:
=== Pre-bind state information ===
LOG: User = Domain\myUser
LOG: DisplayName = Oracle.DataAccess
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Oracle.DataAccess | Domain ID: 3
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:/xx/UDWIntegration/UDWWeb/
LOG: Initial PrivatePath = D:\xx\UDWWeb\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\xx\UDWWeb\web.config
LOG: Using host configuration file: C:\Users\xx\Documents\IISExpress\config\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:/Users/xx/AppData/Local/Temp/Temporary ASP.NET Files/root/ef51aef3/7f23a77a/Oracle.DataAccess.DLL.
LOG: Attempting download of new URL file:///C:/Users/xx/AppData/Local/Temp/Temporary ASP.NET Files/root/ef51aef3/7f23a77a/Oracle.DataAccess/Oracle.DataAccess.DLL.
LOG: Attempting download of new URL file:///D:/xx/UDWWeb/bin/Oracle.DataAccess.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' 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 'Oracle.DataAccess' 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.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +124
System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +44
System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +187
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +74
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +299
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +103
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) +165
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +43
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +31
System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path) +37
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +346
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
- Haben Sie überprüft, die Referenzen auf die Oracle.DataAccess-dll? Vielleicht ist Ihre Anwendung versucht zu laden, es von einem anderen Ort, wo nur die x86-version vorhanden ist. Auch, bestätigen Sie bitte, dass für alle Projekte das Projekt-Eigenschaften -> erstellen -> Plattform Ziel ist x64, wenn die build-Plattform festgelegt ist x64.
- Überprüfen Sie die Ziel-Framework in den Projekt-Eigenschaften für beide apps und stellen Sie sicher, dass Sie übereinstimmen. WinForms standardmäßig wird das Ziel ".NET Framework 4 Client Profile" anstelle von ".NET Framework 4"
- Ich doppelt geprüft, dass beide Projekte werden auf x64. Ich redownloaded Oracle.DataAccess 64 bit dll ' s, und sorgte dafür, dass ich verwiesen dass.
- Haben Sie eine Kopie der Oracle.DataAccess dll in Ihrem Projekt in den Ordner bin? Das ist, wo es versucht zu laden es aus. Visual Studio wird nicht kopieren Sie die dll aus der referenzierten Speicherort der bin-Ordner für Sie. Sie müssen es manuell tun.
- Ja, ich Tat dies auch - danke.
Du musst angemeldet sein, um einen Kommentar abzugeben.
Dein trace zeigt deutlich, dass Ihr code läuft im 32-bit-Modus. Ein 64-bit-Programm lädt die Maschine.config-Datei aus dem c:\windows\microsoft.net\framework64 -Verzeichnis. Also die BadImageFormatException ist ganz erwartet.
Es ist nicht Ihr Projekt zu konfigurieren, in welchem Modus es ausgeführt wird, ist es die app-pool-Konfiguration in IIS, wählt die Bitanzahl. Verwenden Sie die Erweiterten Einstellungen, wie gezeigt, in diese web-Seite zu konfigurieren. Stellen Sie sicher, sprechen Sie mit wem auch immer, normalerweise konfiguriert die Maschine, diese Einstellung zu ändern, ist kein Zufall.
Wenn Sie dieses Problem beim ausführen/Debuggen einer web-app in Visual Studio (VS) mit IIS Express stellen Sie sicher, dass folgende Einstellung aktiviert ist:
Extras>Optionen>Projekte & Lösungen>Web-Projekten>die 64 bit-version von IIS Express für Websites und Projekte
Dies kann gelöst werden, indem der download und führen Sie die Installation.bat-Datei in 'ODAC112030Xcopy.zip" aus 64-bit-Oracle Data Access Components (ODAC) - Downloads.