Ale*_*tic 7 c# firebird event-handling firebird2.1 server
我正在使用fb远程事件来监听数据库,我在我的应用程序加载内部线程启动它.
当我在我的Windows 10(本地PC)上运行它时,它正常工作并完美但是当我在Windows Server 2003上运行它时,它开始填充RAM内存比它应该多得多,当它达到服务器限制时它就会关闭.
这是我的代码:
private void DataBaseEventListner()
{
FbRemoteEvent revent = new FbRemoteEvent(M.Baza.connectionString);
FbRemoteEvent revent1 = new FbRemoteEvent(M.Baza.connectionKomercijalno2018);
revent.RemoteEventCounts += (sender, e) =>
{
this.Invoke(new MethodInvoker(delegate
{
Poruka p = new Poruka(Magacin.Poruka.UcitajPoslednjuPorukuID(Korisnik.korisnikId));
p.Show();
}));
};
revent1.RemoteEventCounts += (sender, e) =>
{
switch (e.Name)
{
case "PP_NEW":
case "PP_UPD":
Thread thread1 = new Thread(UcitajPoslovnePartnere);
thread1.Start();
break;
}
};
revent.QueueEvents(String.Format("nova_poruka~" + Korisnik.korisnikId.ToString()));
revent1.QueueEvents(new string[] { "PP_NEW", "PP_UPD" });
}
private void UcitajPoslovnePartnere()
{
poslovniPartneri = Komercijalno.Partner.Lista();
}
public static List<Int_String> Lista()
{
List<Int_String> list = new List<Int_String>();
using (FbConnection con = new FbConnection(M.Baza.connectionKomercijalno2018))
{
con.Open();
using (FbCommand cmd = new FbCommand("SELECT PPID, NAZIV FROM PARTNER ORDER BY NAZIV", con))
{
FbDataReader dr = cmd.ExecuteReader();
list.Add(new Int_String { _int = -1, _string = "<izaberi partnera>" });
while (dr.Read())
list.Add(new Int_String { _int = Convert.ToInt32(dr[0]), _string = dr[1].ToString() });
}
con.Close();
}
return list;
}
Run Code Online (Sandbox Code Playgroud)
我把它包装成一个try-catch,我得到的错误是:
从连接读取数据时出错.
在
Magacin.Main.DataBaseEventListner()的FirebirdSql.Data.FirebirdClient.FbRemoteEvent.QueueEvents(String []事件)
在firebird日志中,我得到了
TERMINAL_64 (Server) Sat Jun 30 17:03:52 2018
INET/inet_error: read errno = 10054
Run Code Online (Sandbox Code Playgroud)
我尝试过设置Pooling=false但仍然没有工作
我正在加载我的连接字符串.TXT,当我加载它时,我正在构建它像这样:
string[] data = line.Split('|');
//Here I do something with data[0] which is not part of connection string
Baza.connectionString = System.String.Format(@"data source={3};initial catalog = {0};user={1};password={2}", data[1], data[2], data[3], data[4]);
Run Code Online (Sandbox Code Playgroud)
我.TXT文件中的字符串是:
C:\Prirucni Magacin\PRIRUCNIMAGACIN.FDB|SYSDBA|masterkey|localhost //This is on local pc
Run Code Online (Sandbox Code Playgroud)
所以最终字符串看起来像:
data source=localhost;initial catalog = C:\Prirucni Magacin\PRIRUCNIMAGACIN.FDB;user=SYSDBA;password=masterkey
Run Code Online (Sandbox Code Playgroud)
Leg*_*ion -1
根据该错误报告,您的解决方案可能是在连接字符串之后设置该参数:
Pooling=false
Run Code Online (Sandbox Code Playgroud)
例子:
new MySqlConnection("SERVER=localhost;DATABASE=myDB;USER=wiii;PASSWORD=wiiii2;POOLING=FALSE;");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
237 次 |
| 最近记录: |