Hi,
I have developed a windows service in c#. This service is failing very often with "An error occurred during integrated security validation in the connection pooler. GetLastError() returned: '6' " error message in the log.
I have monitored this using windows perfmon utility and found that sometimes, just before falling over, the handle count increased to almost 2500 from 290. I couldn't figure out why this is happening. Code for the service is below. I can provide code for class if required.
Any ideas would be of great help to me. Thanks in advance
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Configuration ;
using System.Threading ;
using System.Reflection ;
using XXX.Lisa.Dal.Entities ;
using XXX.Lisa.Dal ;
using XXX.Lisa.Dls.Queue ;
namespace XXX.Lisa.Dls
{
public class DlsService : System.ServiceProcess.ServiceBase
{
#region This code goes in the main service class
private QueueProcess oQueueProcess ;
private ServiceLogger oServiceLoggerQueueProcess = new ServiceLogger(enumAppID.eDls ) ;
private ServiceLogger oServiceLogger = new ServiceLogger(XXX.Lisa.Dal.Entities.enumAppID.eDls) ;
private System.Timers.Timer LISATimer = new System.Timers.Timer();
#endregion
private System.ComponentModel.Container components = null;
public DlsService()
{
InitializeComponent();
}
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new DlsService() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
private void InitializeComponent()
{
this.CanShutdown = true;
this.ServiceName = "LisaDls";
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
protected override void OnStart(string[] args)
{
#region This code goes into service start
oServiceLogger.Insert(1000,"DLS Start") ;
oServiceLogger.InsertFPSDLS(eApplicationCode.eDLS, 0, "DLS Service Started", "", (int) eReasonCode.eDummy, 0);
XXX.Lisa.Dal.VersionDetails oVersion = new XXX.Lisa.Dal.VersionDetails() ;
oServiceLogger.Insert(1001,"DAL Version : " + oVersion.Get) ;
oServiceLogger.InsertFPSDLS(eApplicationCode.eDLS, 0, "DAL Version : " + oVersion.Get, "", (int) eReasonCode.eDummy, 0);
#region QueueThread
oQueueProcess = new QueueProcess() ;
QueueThread.Start() ;
QueueThread = null ;
#endregion
#endregion
}
protected override void OnStop()
{
#region This code goes into service stop
oQueueProcess.Stop();
oServiceLogger.Insert(1999,"DLS Stop") ;
oServiceLogger.InsertFPSDLS(eApplicationCode.eDLS, 0, "DLS Service Stopped", "", (int) eReasonCode.eDummy, 0);
#endregion
}
protected override void OnShutdown()
{
#region This code goes into service shutdown
LISATimer.Enabled = false;
oServiceLogger.Insert(1998,"DLS Shutdown") ;
oServiceLogger.InsertFPSDLS (eApplicationCode.eDLS, 0, "DLS Service Shut Down", "", (int) eReasonCode.eDummy, 0);
#endregion
}
private void oQueueProcess_QueueProcess_Status_Event(object sender, XXX.Lisa.Dls.Queue.QueueProcess.QueueProcess_Status_EventArgs e)
{
oServiceLoggerQueueProcess.Insert(e.StatusCode,e.StatusMessage) ;
}
private void Stop_Threads()
{
try
{
if (!oQueueProcess.Stopped) oQueueProcess.Stop() ;
}
catch
{
}
}
}
}