I'm trying to run a solution on Azure. I'm using the latest DO RC2 release dlls. As soon as I add the Xtensive assemblies as references to the Services role project, upon debugging and navigating to, I get the below exception.

I'm guessing it has something to do with the fact that I'm running Windows 7 x64 and the Oracle dll isn't present in x64 format (note the bad image format message in the error)...but my question is why is simply referencing the Xtensive dlls causing my services role to try to load the Oracle dll(s)? I'm not even referencing the Oracle specific Xtensive dlls. I've created an x86 build configuration but then I get a message from Visual Studio telling me that Azure tools only supports AnyCPU and x64.

Thanks in advance for your assistance.

Server Error in '/' Application.


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. 
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 'Oracle.DataAccess' 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 'Oracle.DataAccess' could not be loaded.

=== Pre-bind state information ===
LOG: User = sd39p2\Administrator
LOG: DisplayName = Oracle.DataAccess
LOG: Appbase = file:///D:/Development/Soaf/Soaf/bin/Debug/Soaf.csx/roles/Soaf.Services/approot/
LOG: Initial PrivatePath = D:\Development\Soaf\Soaf\bin\Debug\Soaf.csx\roles\Soaf.Services\approot\bin
Calling assembly : System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Development\Soaf\Soaf\bin\Debug\Soaf.csx\roles\Soaf.Services\approot\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\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/Administrator/AppData/Local/dftmp/s0/deployment(35)/res/deployment(35).Soaf.Soaf.Services.0/aspNetTemp/aspNetTemp/root/5e783598/8912df93/Oracle.DataAccess.DLL.
LOG: Attempting download of new URL file:///C:/Users/Administrator/AppData/Local/dftmp/s0/deployment(35)/res/deployment(35).Soaf.Soaf.Services.0/aspNetTemp/aspNetTemp/root/5e783598/8912df93/Oracle.DataAccess/Oracle.DataAccess.DLL.
LOG: Attempting download of new URL file:///D:/Development/Soaf/Soaf/bin/Debug/Soaf.csx/roles/Soaf.Services/approot/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.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +416
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +147

[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) +1413
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +673
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +131
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +92
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +293
   System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +342
   System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +94
   System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +513
   System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +245
   System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +885
   System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +162
   System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +103
   System.Web.Compilation.BuildManager.GetVPathBuildResult(VirtualPath virtualPath) +58
   System.Web.Compilation.BuildManager.GetCompiledCustomString(String virtualPath) +73
   System.ServiceModel.HostingManager.GetCompiledCustomString(String normalizedVirtualPath) +278
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +202
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +67
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1004

[ServiceActivationException: The service '/DataService.svc' cannot be activated due to an exception during compilation.  The exception message is: 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.ServiceModel.AsyncResult.End(IAsyncResult result) +758
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +490
   System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +78
   System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +202

Updated at 01.03.2010 3:58:00

Ok, nevermind, I figured it out. It was caused by referencing Xtensive.Storage.All, which seems to include all your storage providers...

Is there any documentation on what dlls I should be referencing for my solution? I've been just guessing/copying from some of your sample projects. There are a bunch of dlls and it's not clear to me what's necessary and what's not...especialling with those Indexing and Modeling dlls...

A list of each dll, what it's responsible for and whether or not it's required would be really helpful.

Thank you.

This thread was imported from our support forum. The original discussion may contain more detailed answer. Original topic by JeffN.

asked Mar 01 '10 at 03:47

Editor's gravatar image


One Answer:

Xtensive.Storage.All is soluation used by our indirect dependency copy extension (.target) to MSBuild. .All projects do nothing but just reference all the assemblies that might be* required on the client. E.g.:

  • Xtensive.Sql.All.dll references all Xtensive.Sql.<providername>.dll (SQL DOM providers), so if you reference it (directly or indirectly), all DLLs like NPgSql.dll will be copied to output folder.

  • Xtensive.Storage.All.dll references Xtensive.Sql.All.dll, as well as all storage providers (that are also loaded dynamically).

So if your project references Xtensive.Storage.All.dll, you get all its dependencies copied to the output folder. If you won't reference it (that's ok), you won't get indirect references copied, so it will be necessary to either do this manually, or ro create your own project like Xtensive.Storage.All containing just the assemblies you need, and reference it from your own.

Now returning back to your problem: I suspect the issue with deployment to Azure appears because Oracle.DataAccess.dll is 32-bit only assembly. We deeply hate Oracle for such crazy stuff (there was planty of similar, i.e. absolutely unreasonable and inconvenient limitations there - it looks like they still think developers write SQL manually and target just a specific version of Oracle). So some day we must clone our Xtensive.Sql.Oracle project to compile its 64-bit version dependent on 64-bit version of their provider, or do something similar.

Ok, and to eliminate the issue @ Azure, you must ensure Oracle.DataAccess.dll isn't deployed there. I hope this will be enough.

Concerning producing minimal set of DLLs to deploy: you need all our DLLs except Xtensive.Sql.<unusedprovider> and all their dependencies.

E.g. NPgSql.dll references Mono.Security.dll, and if you don't use this provider, you don't need:

  • Xtensive.Sql.PostgreSql.dll

  • NPgSql.dll

  • Mono.Security.dll.

answered Mar 01 '10 at 15:01

Alex%20Yakunin's gravatar image

Alex Yakunin

Currently Oracle.DataAccess.dll is shipped as AnyCPU assembly, so this is irrelevant now.

(Oct 18 '10 at 00:03) Alex Yakunin Alex%20Yakunin's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview


Once you sign in you will be able to subscribe for any updates here



Asked: Mar 01 '10 at 03:47

Seen: 8,181 times

Last updated: Oct 18 '10 at 00:03

powered by OSQA