我有一个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;
}
我将其包装在try-catch
中,并且得到的错误是:
从连接读取数据时出错。
在FirebirdSql.Data.FirebirdClient.FbRemoteEvent.QueueEvents(String [] events)
在Magacin.Main.DataBaseEventListner()
我在火鸟日志中得到
TERMINAL_64 (Server) Sat Jun 30 17:03:52 2018
INET/inet_error: read errno = 10054
我尝试设置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]);
我的.TXT
文件中的字符串是:
C:\Prirucni Magacin\PRIRUCNIMAGACIN.FDB|SYSDBA|masterkey|localhost //This is on local pc
因此最终字符串如下:
data source=localhost;initial catalog = C:\Prirucni Magacin\PRIRUCNIMAGACIN.FDB;user=SYSDBA;password=masterkey
答案 0 :(得分:-1)
根据that bugreport,可能是您的解决方案在连接字符串之后设置了该参数:
Pooling=false
示例:
new MySqlConnection("SERVER=localhost;DATABASE=myDB;USER=wiii;PASSWORD=wiiii2;POOLING=FALSE;");