简体   繁体   English

.NET不使用AppDomain中加载的Oracle.DataAccess.dll

[英].NET does not use Oracle.DataAccess.dll loaded in AppDomain

I keep running into an issue where my ASP.NET web app keeps throwing on error on trying to load Oracle.DataAccess.dll. 我一直遇到一个问题,我的ASP.NET Web应用程序在尝试加载Oracle.DataAccess.dll时不断抛出错误。 I'm noticing this issue when I have both the 64-bit and 32-bit Oracle.DataAccess.dll installed. 当我同时安装了64位和32位Oracle.DataAccess.dll时,我注意到此问题。

LOG: DisplayName = Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342 (Fully-specified)
LOG: Appbase = file:///C:/Dev/repository/trunk/myapp/
LOG: Initial PrivatePath = C:\Dev\repository\trunk\myapp\bin

Calling assembly : DataAccess.Oracle, Version=15.0.0.26242, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Dev\repository\trunk\myapp\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: Post-policy reference: Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

The 2.102.2.20 is the version I built my projects with. 2.102.2.20是我用来构建项目的版本。

Specific Version is set to false 特定版本设置为false

The Runtime Version is set to v2.0.5.0727 (in case that matters) 运行时版本设置为v2.0.5.0727(以防万一)

Currently, I am loading a newer Oracle.DataAccess.dll dynamically System.Reflection.Assembly.Load() into the AppDomain. 当前,我正在将System.Reflection.Assembly.Load()动态加载到较新的Oracle.DataAccess.dll到AppDomain中。 I have my IIS to load 32-bit Applications so it is correctly loading the x86 assembly. 我的IIS可以加载32位应用程序,因此它可以正确加载x86程序集。 I've confirmed that this is loaded and present before my data access layer references Oracle.DataAccess.dll. 我已确认在我的数据访问层引用Oracle.DataAccess.dll之前已加载并存在该文件。

In addition, I reviewed my web.config and I do have assembly bindings to target the newer version. 此外,我查看了web.config,并具有程序集绑定以定位较新的版本。 Tried with and without the bindings and it doesn't seem to matter. 尝试有无绑定,这似乎无关紧要。

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <bindingRedirect oldVersion="2.102.2.20" newVersion="2.112.1.0" />
  </dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <bindingRedirect oldVersion="2.102.2.20" newVersion="4.112.3.0" />
    <publisherPolicy apply="no" />
  </dependentAssembly>
</assemblyBinding>

Why does .NET try to load the older version? .NET为什么尝试加载旧版本? I thought if I have the assembly loaded in the AppDomain, it would just use this version? 我以为如果我在AppDomain中加载了程序集,它将使用该版本吗?


My GAC for Oracle.DataAccess.dll looks like this: 我的GAC for Oracle.DataAccess.dll如下所示: Windows \\装配Windows \\ Microsoft.NET \\ assembly \\ GAC_32

Oddly enough, my GAC_64 folder's entry for Oracle.DataAccess.dll is empty. 奇怪的是,我的Oracle.DataAccess.dll的GAC_64文件夹条目为空。

I ran a console utility test that looks for registered .dll is GAC. 我运行了一个控制台实用程序测试,查找已注册的.dll是GAC。 应用程序找到了这些Oracle.DataAccess.dll


I did play with my web.config assembly bindings a little and now it works for some reason. 我确实使用了我的web.config程序集绑定,但现在由于某种原因它可以工作了。 Still don't understand what was going on. 还是不明白发生了什么。 I added a range and assembly Identity info, perhaps this whole time, it just didn't know what assembly I was talking about in the web.config. 我添加了一个范围和程序集标识信息,也许这是整整一次,它只是不知道我在web.config中谈论的是什么程序集。

  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342"/>
    <bindingRedirect oldVersion="2.102.2.20-2.102.9999.9999" newVersion="2.112.1.0" />
  </dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342"/>
    <bindingRedirect oldVersion="2.102.2.20-2.102.9999.9999" newVersion="4.112.3.0" />
    <publisherPolicy apply="no" />
  </dependentAssembly>
</assemblyBinding>

Well, I don't know if I got the answer I wanted but it appears that the assembly bindings being generated into the web.config may be incomplete or wrong based on some changes I made awhile back. 好吧,我不知道我是否能得到想要的答案,但是根据我不久前所做的一些更改,似乎正在生成到web.config中的程序集绑定可能不完整或错误。

It appears with the assembly identity information, .NET is able to reconcile that the referenced older assembly can be "replaced" with the newer assembly loaded into the AppDomain. 与程序集标识信息一起出现时,.NET可以协调,将引用的旧程序集与“新程序集”加载到AppDomain中可以“替换”。 Otherwise, it just has a version number and will ignore the assembly binding in the web.config. 否则,它仅具有版本号,并且将忽略web.config中的程序集绑定。 What this does confirm to me is that even though I do all this effort to load the newest Oracle.DataAccess.dll, it is really the assembly bindings that decide what version will be used and I shouldn't try to rid my config files of these assembly bindings. 这确实向我确认的是,即使我付出了所有努力来加载最新的Oracle.DataAccess.dll,也确实是程序集绑定决定了将使用哪个版本,并且我不应该尝试摆脱配置文件的约束。这些程序集绑定。

More or less, for my case where I want to control .dll versioning, use assembly bindings generated off looking at what is installed on the machine as needed and do not rely on .NET blindly using the .dll loaded into the app domain. 对于我要控制.dll版本的情况,或多或少地,请使用根据需要查看计算机上安装的内容生成的程序集绑定,而不要盲目地使用加载到应用程序域中的.dll来依赖.NET。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 .NET 4.0对错误的Oracle.DataAccess.dll的引用 - .NET 4.0 Reference to wrong Oracle.DataAccess.dll Oracle.DataAccess.dll提供程序和dll不兼容 - Oracle.DataAccess.dll Providers and dll not compatible 使Oracle.DataAccess.dll摆脱垃圾箱 - Keep Oracle.DataAccess.dll out of bin 从Oracle.DataAccess.dll抛出NullReferenceException - NullReferenceException Thrown from Oracle.DataAccess.dll 包含 Oracle.DataAccess.dll 的最佳方式 - Best way to include Oracle.DataAccess.dll 如何在 asp.net 应用程序中使用新的 Oracle.DataAccess.dll 版本 4.xxx 而无需编译代码 - How to use new Oracle.DataAccess.dll version 4.x.x.x in asp.net app without have to compile the code Oracle ODP.net非托管12.2(Oracle.DataAccess.dll)需要哪些依赖项/ dll? - What are required dependencies/dlls for Oracle ODP.net unmanaged 12.2 (Oracle.DataAccess.dll)? 如何使.Net Oracle.DataAccess.dll(ODP)像MS一样提供工作 - How to get .Net Oracle.DataAccess.dll (ODP) to work like MS provided equivalent 有人知道 Oracle.DataAccess.dll 版本 2.122.1.0 是否支持版本 2.112.2.0 的所有内容 - Does someone know whether Oracle.DataAccess.dll version 2.122.1.0 supports everything that version 2.112.2.0 在Visual Studio C#项目中包含Oracle.DataAccess.dll - Include Oracle.DataAccess.dll in Visual Studio C# Project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM