Click here to Skip to main content
15,899,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		public DlsService()
		{
			// This call is required by the Windows.Forms Component Designer.
			InitializeComponent();
			// TODO: Add any initialization after the InitComponent call
		}
		// The main entry point for the process
		static void Main()
		{
			System.ServiceProcess.ServiceBase[] ServicesToRun;
	
			// More than one user Service may run within the same process. To add
			// another service to this process, change the following line to
			// create a second service object. For example,
			//
			//   ServicesToRun = new System.ServiceProcess.ServiceBase[] {new Service1(), new MySecondUserService()};
			//
			ServicesToRun = new System.ServiceProcess.ServiceBase[] { new DlsService() };
			System.ServiceProcess.ServiceBase.Run(ServicesToRun);
		}
		/// <summary> 
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			// 
			// DlsService
			// 
			this.CanShutdown = true;
			this.ServiceName = "LisaDls";
		}
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		/// <summary>
		/// Set things in motion so your service can do its work.
		/// </summary>
		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
		}
 
		/// <summary>
		/// Stop this service.
		/// </summary>
		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
		}
		//#region Commented Code 
		//This code goes at the bottom Service.cs
		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
			{
			}
		}
		//#endregion

	}
}
Posted

Mohith Kumar wrote:
integrated security validation in the connection pooler.

You might want to have a look in your DAL code and add error handling specifically around where connections are made, and if you don't already have it add some error reporting into your DAL so that you can see the exception messages.
 
Share this answer
 
Hi Rod Kemp,
Thanks for your direction. I use Microsoft's SQLHelper classes to handle connections. I do not open/close connections outside SQLHelper. So it is becoming difficult for me to troubleshoot this. Have you ever come across this error "Integrated Security Validation in the connection Pooler".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900