Sahil, this is the first time has happened in a year! We have had some
serious load in the past and never this error message. Now how many requests
would be a whole lot of requests? Also, what do you mean by "Also, if you
are using dataadapter, then don't open the explicitly connection at all."
Below is a code snippet of the webservice class. I have a custom dll that
opens the connection when instantiated and closes it when destroyed.
WEB SERVICE:
<WebService(Namespace := "
https://url")> Public Class MyWebService
Inherits Webservice
Private strdsn as string
Private objDB as dbClass
Public Sub New()
strdsn = ConfigHelper.GetValueFromConfigFile("DSN")
objDB = new dbClass(strdsn)
End Sub
Sub Destruct()
objDB.dispose()
objDB = Nothing
End Sub
End Class
DB CLASS:
Public Class DBClass
Implements IDisposable
Private objConnect as SqlConnection
Private objTrans as SQlTransaction
Private logName, sourceName as string
Private objLog as logClass
Private logError as Boolean
Public Sub New(byval strdsn as string)
logError = False
logName = ConfigHelper.GetValueFromConfigFile("LogName")
sourceName = ConfigHelper.GetValueFromConfigFile("SourceName")
if (len(logName) > 0 and len(sourceName) > 0) Then
logError = True
objLog = new logClass(logname, sourcename)
end if
if len(strdsn) = 0 Then
throw new ServicesException("No dsn string passed in constructor
statement.", 1)
end if
Try
objConnect = new SqlConnection(strdsn)
objConnect.Open
Catch objException as InvalidOperationException
if logError Then objLog.LogEvent(GetErrorMessage(objException.Message),
eventlogentrytype.error)
throw new ServicesException("Connection to database cannot be opened: no
server specified OR connection is already open.")
Catch objException as SQLException
if logError Then objLog.LogEvent(GetErrorMessage(objException.Message),
eventlogentrytype.error)
throw new ServicesException("Connection to database could not be
established. The server maybe down.")
End Try
End Sub
Public Sub Dispose() Implements System.IDisposable.Dispose
objConnect.dispose()
if logError Then objLog = Nothing
End Sub
End Class