Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# OracleDependency指定端口赢得';行不通_C#_Database_Oracle_Odp.net_Change Notification - Fatal编程技术网

C# OracleDependency指定端口赢得';行不通

C# OracleDependency指定端口赢得';行不通,c#,database,oracle,odp.net,change-notification,C#,Database,Oracle,Odp.net,Change Notification,首先,我将.NET4.5与C#一起使用 我有一个奇怪的问题,真的找不到任何方法来进一步调试它。 当我为OracleDependency指定一个端口时,它仍然使用一个随机端口,因为它提供了一个ORA-24911,无法在指定端口启动侦听器线程 如果我没有为OracleDependency指定端口,那么一切都正常。问题在于,该代码在上周五之前一直使用生产中指定的端口,当时该应用程序已更新到最新版本(尽管注册OracleDependency的代码从2018年起没有更改) 这是我用来理解发生了什么的代码

首先,我将.NET4.5与C#一起使用

我有一个奇怪的问题,真的找不到任何方法来进一步调试它。 当我为OracleDependency指定一个端口时,它仍然使用一个随机端口,因为它提供了一个ORA-24911,无法在指定端口启动侦听器线程

如果我没有为OracleDependency指定端口,那么一切都正常。问题在于,该代码在上周五之前一直使用生产中指定的端口,当时该应用程序已更新到最新版本(尽管注册OracleDependency的代码从2018年起没有更改)

这是我用来理解发生了什么的代码

using (OracleCommand command = new OracleCommand(sql, connection))
{
    File.AppendAllText("result.txt", "Set AddRowId to true" + Environment.NewLine);
    command.AddRowid = true;


    if (notificationPort != null)
    {
        File.AppendAllText("result.txt", "Set OracleDependency port to " + notificationPort.ToString());
        OracleDependency.Port = notificationPort.Value;
    }
    else
    {
        File.AppendAllText("result.txt", "No OracleDependency port specified. Let Oracle choose port");
    }

    File.AppendAllText("result.txt", "Creating OracleDependency object" + Environment.NewLine);
    dependency = new OracleDependency(command);
    File.AppendAllText("result.txt", "Created OracleDependency object" + Environment.NewLine);

    File.AppendAllText("result.txt", "Setting command.Notification.IsNotifiedOnce to false" + Environment.NewLine);
    command.Notification.IsNotifiedOnce = false;
    File.AppendAllText("result.txt", "Setted command.Notification.IsNotifiedOnce" + Environment.NewLine);

    File.AppendAllText("result.txt", "Setting command.Notification.Timeout to 0" + Environment.NewLine);
    command.Notification.Timeout = 0;
    File.AppendAllText("result.txt", "Setted command.Notification.Timeout to 0" + Environment.NewLine);

    //File.AppendAllText("result.txt", "Setting OnChange event of dependency object" + Environment.NewLine);
    //dependency.OnChange += new OnChangeEventHandler(Callback);
    //File.AppendAllText("result.txt", "Setted OnChange event of dependency object" + Environment.NewLine);

    File.AppendAllText("result.txt", "Executing command in order to register the dependency" + Environment.NewLine);
    int queryRegistered = command.ExecuteNonQuery();
    File.AppendAllText("result.txt", "Executed command in order to register the dependency" + Environment.NewLine);

    if (queryRegistered == -1)
    {
        File.AppendAllText("result.txt", "Database notification handler registered successfully." + Environment.NewLine);
        File.AppendAllText("result.txt", Environment.NewLine);
    }
    else
    {
        File.AppendAllText("result.txt", "Error registering database notifications handler: " + queryRegistered);
        File.AppendAllText("result.txt", Environment.NewLine);
    }
}
当然,这没有多大帮助,因为我怀疑的是,当对数据库执行ExecuteOnQuery时,数据库返回了ORA-24911

有人对我如何进行调试以发现可能发生的情况有什么建议吗

提前谢谢