//连接短信发送服务器 emptcl empp = new emptclClass(); ConnectResultEnum result = empp.connect(host, port, accountId, password); if (empp == null || !empp.connected) { return "连接失败"; } ShortMessage shortMsg = new ShortMessageClass(); shortMsg.srcID = accountId; //获取发送短信者ID shortMsg.needStatus = true; //获取是否返回状态报告标志 Mobiles mob = new MobilesClass(); string[] sendMobiles = mobiles.Trim('|').Split('|'); foreach (string sendMobile in sendMobiles) { mob.Add(sendMobile); } shortMsg.DestMobiles = mob; //发送的手机号 shortMsg.content = contents; //短信内容 shortMsg.SendNow = true; //设置是否立即发送短信标志 //发送短信 empp.submit(shortMsg); //对象用于实现发送短信后,接受到的返回信息的处理 SubmitResp submitResp = new SubmitRespClass(); int doResult = -1; Int32.TryParse(submitResp.Result.ToString(), out doResult); if (doResult == 0) { mob.RemoveAll(); return "成功"; } else { return "失败"; } empp.disconnect();
上面就是主要的代码,写在了一个Webservice里面,平均5天左右就会导致服务挂掉,求大神指教!
设置一下进程池 2天自动回收一下 这个是因为内存泄漏!