quot;connection rejected by remote interfacequot; in C# program connecting to Firebird 3(连接被连接到Firebird 3的C#程序中的远程接口拒绝(Q))
问题描述
从Firebird 2.5迁移到3.0后,当我尝试使用C#程序测试数据库的连接时,显示此错误"Connection Reduced by Remote Interface."
以下是测试连接的代码,我在尝试连接到Firebird 2.5数据库时使用此代码。
txtPassword.Properties.UseSystemPasswordChar = true;
txtHostname.Text = Properties.Settings.Default.server;
txtUsername.Text = Properties.Settings.Default.user;
txtPassword.Text = Properties.Settings.Default.pass;
txtDBPath.Text = Properties.Settings.Default.dbpath;
void Testdbconn()
{
try
{
var testInMemUnicode =
String.Format("DataSource={0};Database={1};User ID={2};Password={3}; Charset=NONE;",
txtHostname.Text,
txtHostname.Text + ":" + txtDBPath.Text.Trim(),
txtUsername.Text,
txtPassword.Text);
var testConnParam = new FbConnection(testInMemUnicode);
testConnParam.Open();
XtraMessageBox.Show(@"Connection to the server is successful.", @"Data Server Test",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch (Exception errorCode)
{
XtraMessageBox.Show(@"Error in connection: " + errorCode.Message,
@"Server Error",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
class ClsConnection
{
public static string FirebirdSQL = String.Format(
"DataSource={0}; Database={1}; User ID={2}; Password={3}; Charset=NONE; Port=3050; Dialect=3;" +
"Connection lifetime=15; Pooling=true; MinPoolSize=0; MaxPoolSize=2000000; Packet Size=8192; ServerType=0",
Properties.Settings.Default.server, Properties.Settings.Default.db + ":" + Properties.Settings.Default.dbpath,
Properties.Settings.Default.user, Properties.Settings.Default.pass);
private static readonly string FirebirdService = FirebirdSQL;
/// <summary>
///
/// </summary>
public static FbConnection Firebird = new FbConnection(FirebirdService);
/// <summary>
///
/// </summary>
public void Openconnection()
{
if (Firebird.State == System.Data.ConnectionState.Open)
{
Firebird.Close();
}
Firebird.Open();
}
/// <summary>
///
/// </summary>
public void Closeconnection()
{
Firebird.Close();
}
}
推荐答案
对于此答案,我假设您使用的是最新的Firebird ADO.Net版本(例如5.12.0.0,但至少是5.0.0.0)。
Firebird 3引入了有线协议加密,这在默认情况下是必需的。在撰写本文时,Firebird ADO.NET提供程序不支持这种加密。因此,连接尝试将失败,并显示错误"远程接口拒绝连接"(错误代码335544421)。
解决方案是修改Firebird配置以仅启用而不需要有线协议加密。为此,请编辑Firebird服务器的firebird.conf
并将设置WireCrypt
更改为WireCrypt = Enabled
(如果当前以#
为前缀,则删除#
),然后重新启动Firebird服务器。如果Firebird安装在Program Files中,则需要以管理员权限运行您的编辑器才能正确保存文件。
请注意,在客户端和服务器之间的握手不能就某些连接和协议选项达成一致的其他情况下也可能发生此错误。
这篇关于连接被连接到Firebird 3的C#程序中的远程接口拒绝(&Q)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:连接被连接到Firebird 3的C#程序中的远程接口拒绝(&Q)


- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 输入按键事件处理程序 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- MoreLinq maxBy vs LINQ max + where 2022-01-01