Set time for a web service method in code


I have a web service, which calls multiple methods at a time and executes. In which one particular method has getting timed out after 2 minutes. As this method has many database actions to be completed for multiple records.

Like this method call 10 records and loop through each record and do the database process in the loop. But after 2 minutes before completing all the record actions this method is giving time out error as below in our logging mechanism.

System.Web.HttpException (0x80004005): Request timed out.

The web method is written as below where all the actions taken place,

 <WebMethod(Description:="For processing Validate DR")>
        Public Function ProcessValidateDRCases() As Boolean
          'code goes here
         End function

And this webmethod is call inside a service as below,

Public Sub ProcessValidateDRCases()
        Dim wsCasyBatchMonitor As New WSICI_COMPASSMonitor.BatchMonitoring
            ' Get and set the web servire url appropriately.
            WebServiceURL = ReadSettingsValue(ALIAS_WEBSERVICE_URL)
            If WebServiceURL <> "" Then
                wsCasyBatchMonitor.Url = WebServiceURL & "/BatchMonitoring.asmx"
                Log(LogType.Warning, "Calling Web Method ProcessValidateDRCases() in ICI_COMPASSMonitoring", System.Reflection.MethodBase.GetCurrentMethod().Name)
                ' call the web method now.
                Log(LogType.Warning, "Web Method call ProcessValidateDRCases() completed in ICI_COMPASSMonitoring", System.Reflection.MethodBase.GetCurrentMethod().Name)
            End If
        Catch ex As Exception
            LogException(LogType.Error, "Failed to call WS ProcessValidateDRCases with URL: " & ReadSettingsValue(ALIAS_WEBSERVICE_URL), System.Reflection.MethodBase.GetCurrentMethod().Name, ex)
        End Try

    End Sub

My dout is that is there any way to give this particular method time morethan 2 minuites.

Regards Sangeetha
asked on Stack Overflow May 19, 2020 by user703526

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0