ODP.NET + 端口 6200 上的意外流量(Oracle 通知服务)

ODP.NET + Unexpected traffic on port 6200 (Oracle Notification Services)

我们有一个客户在使用我们的产品,其中包括使用 .NET 4+、Entity Framework 和 ODP.NET 构建的 windows 服务。由于某种原因,在一个特定的安装中,而不是其他任何原因,windows 服务似乎在 6200 上产生流量。Oracle Documentation indicates this is the port Oracle Notification Services uses. This is unexpected because our product does not utilize ONS. I've found other Oracle Documentation that indicates that RAC / Fast Failover also uses ONS, but we've confirmed with the client that they do not use RAC in any environments, and we are not using the RAC options in the connection string. We are also not (to our knowledge) using Database Change Notifications 或执行任何 cache/verification 缓存数据,这听起来也利用 ONS。

任何人都可以帮助解释为什么我们会产生端口 6200 流量,更重要的是,如何让它停止?谢谢!

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings [Redacted] />
  <appSettings [Redacted] />
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </providers>
    <contexts>
      <context type="[Redacted]" disableDatabaseInitialization="true" />
    </contexts>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="Oracle.ManagedDataAccess.Client" />
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
  </system.data>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" />
  </runtime>
</configuration>

这可能取决于安装的 Oracle 客户端版本。在 12.1.0.2 中发布了 ONS 功能的自动配置。它可能在建立产生此流量的数据库连接开始时具有类似 ONS 自动发现的功能。

我们已将罪魁祸首缩小到 3 个 Oracle / ODP.NET 特定连接字符串设置中的一个或多个:

ENLIST, HA EVENTS, and/or LOAD BALANCING

Oracle 关于 Fast Application Notification tipped us off to these settings which we had not been aware of. This lead us to Oracle's documentation on all of their Feature Connection String Attributes 的文档。

Enlist - Default "true" - Serviced components automatically enlist in distributed transactions.

HA Events - Default "false" - Enables ODP.NET connection pool to proactively remove connections from the pool when a RAC service, service member, or node goes down.

Load Balancing - Default "false" - Enables ODP.NET connection pool to balance work requests across RAC instances based on the load balancing advisory and service goal.

我们将3个都显式设置为false,端口6200连接结束。

ENLIST=false; HA EVENTS=false; LOAD BALANCING=false;

如果相信默认值,那么 Enlist 就是罪魁祸首,但客户的可用性不允许进行离散测试来确认。我们发现了其他各种文档,这些文档将所有这 3 项功能都链接到 Oracle Notification Services 和端口 6200。