应用程序访问domino 数据库问题(程序运行开始运行正常,运行几天之后读取domino数据库记录失败)!

qinxiaolin 2008-07-09 01:26:59
如题:
写了一个windows服务程序,定时(15s)去访问domino 服务器端数据库(数据库文件名sms.nsf),并将读取的数据记录以短信形式发送出去,并将已读取的数据记录从sms.nsf库中删除。
程序开始时,能够正确读取domino服务器端的数据库文件。
运行4、5天后,用户收不到短信。domino server 的控制台界面仍打印 windows服务程序读取sms.nsf的连接信息,
但是sms.nsf里有大量的数据记录待读取。不知是否时windows 服务程序过于频繁向domino 服务器发起连接请求所至?
各位大侠是否遇到过类似的问题。关键代码如下:
private void timer1_Elapsed_1(object sender, System.Timers.ElapsedEventArgs e)
{
NotesSession oNotesSession = null;
NotesDatabase oNotesDatabase = null;
try
{
oNotesSession = new Domino.NotesSession(); //create a notes session object
oNotesSession.Initialize(Password);

oNotesDatabase = oNotesSession.GetDatabase(sServerName, nsfFile, false);
if (!oNotesDatabase.IsOpen)
{
oNotesDatabase.Open();
}
Domino.NotesView oNotesView = oNotesDatabase.GetView("VD_UNsendinfo");
Domino.NotesDocument CurDoc = oNotesView.GetFirstDocument();
string SendMan = "";
string SendContent = "";
while (CurDoc != null)
{
NotesDocument pDoc = CurDoc;
CurDoc = oNotesView.GetNextDocument(CurDoc);
SendMan = pDoc.GetFirstItem("F_SendtoNum").Text;
SendContent = pDoc.GetFirstItem("F_Smsbody").Text;

SMS.Service smsSev = new WinSerTest.SMS.Service();
smsSev.SendMessage(smsName, appId, smsPassword, SendMan, SendContent);

pDoc.ReplaceItemValue("F_IsSend", "1");
pDoc.Save(true,false,false);
}
}
catch (Exception error)
{
MessageBox.Show(error.Message);
}
finally
{
oNotesSession = null;
oNotesDatabase = null;
}
}


...全文
75 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,825

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧