简体   繁体   English

如何用 web.config 部分替换 machine.config 的“oracle.manageddataaccess.client”部分

[英]How to replace the “oracle.manageddataaccess.client” section of machine.config with web.config section

Good morning, my application uses oracle.manageddataaccess.client, when installing oracle.managedDataAccess via Nuget, a reference was created in my web.config as below: Good morning, my application uses oracle.manageddataaccess.client, when installing oracle.managedDataAccess via Nuget, a reference was created in my web.config as below:

<configSections> 
  <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, 
  Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>

For my application to run, I need the identical section in the machine.config file.要运行我的应用程序,我需要 machine.config 文件中的相同部分。 (Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Config \ machine.config), machine.config file below: (Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config),machine.config文件如下:

配置 machine.config

The problem is that whenever I need to run another application with a different version of oracle, the error occurs with duplicate key, because in web.config a version is configured, and in machine.config, the section is configured with another version.问题是,每当我需要使用不同版本的 oracle 运行另一个应用程序时,重复键就会发生错误,因为在 web.config 中配置了一个版本,而在 machine.config 中,该部分配置了另一个版本。 It is always necessary to manually edit the file machine.config and setting the version according to the version of web.config.始终需要手动编辑文件 machine.config 并根据 web.config 的版本设置版本。

What I tried to accomplish to solve the problem was:我试图解决这个问题的是:

  • add allowOverride="true" in web.config section (Unrecognized Attribute)在 web.config 部分添加 allowOverride allowOverride="true" (无法识别的属性)
  • Add a <clear /> element in section (no success)在 section 中添加<clear />元素(不成功)

I found that on other machines where it is not necessary to put the manual version, machine.config uses the section oracle.dataaccess.client , so I researched is due to using the unmanaged odp.net driver, changing my section for this too did not work.我发现在不需要放置手动版本的其他机器上, machine.config 使用oracle.dataaccess.client部分,所以我研究是由于使用了非托管 odp.net 驱动程序,因此也更改了我的部分不行。

Would there be any way to override this section?有什么方法可以覆盖此部分吗? Or use oracle.dataaccess.client to resolve this issue.或者使用oracle.dataaccess.client来解决这个问题。

I got it to work by using the following in web.config:我通过在 web.config 中使用以下内容使其工作:

<configSections>
      <section name="new.oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>

And later use the new config section:稍后使用新的配置部分:

  <new.oracle.manageddataaccess.client>
    <version number="*">
           <!--Oracle configuration settings-->
    </version>
  </new.oracle.manageddataaccess.client>

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

相关问题 ADO.NET提供程序“Oracle.ManagedDataAccess.Client”未在计算机或应用程序配置文件中注册,或者无法加载 - The ADO.NET provider 'Oracle.ManagedDataAccess.Client' is either not registered in the machine or application config file, or could not be loaded 如何在EF 6提供程序配置文件中添加/激活“ Oracle.ManagedDataAccess.Client”? - How to Add/Activate “Oracle.ManagedDataAccess.Client” in the EF 6 provider config file? 如何确定是从app.config还是machine.config加载配置节或元素? - How to determine if a config section or element is loaded from app.config or machine.config? 在 .net 4.5 中的 web.config 中覆盖 Machine.config 的值 - Overriding values of Machine.config in web.config in .net 4.5 如何转换这个web.config部分? - How to transform this web.config section? 如何修改web.config部分运行时? - How to modify web.config section runtime? MVC 5 IIS; 在web.config之前使用machine.config - MVC 5 IIS; Using machine.config prior to web.config 区分machine.config和web.config中的ConnectionString - Differentiate between ConnectionStrings in the machine.config and web.config 本节中的web.config转换 - web.config transformations in section 将部分添加到web.config时,配置部分将是什么? - what will be the config section when adding a section to web.config?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM