Craig C
Craig C

Reputation: 165

How To Insert A Timeout Value Into A VB.NET Console Application?

I have a series of 3 web services which run consecutively- the first one triggers a huge stored procedure, and the next two apply .NET logic to the results. To enable me to schedule these I created 3 really basic Console Applications so that I could use Windows Task Scheduler to run the EXE file for each one overnight. The console app simply contains a web reference to the web services, then makes a call within a Try Catch block for error logging. For example, the main part of the first console application shows:

Sub Main()
    Dim wscall As New EmployeeWS
    Try
      wscall.UpdateAbsence()
    Catch Ex As Exception
      WriteLog("Error - UpdateAbsence :" & DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " " & Ex.Message)
    End Try
End Sub

My problem here seems to be that the call successfully goes out to the UpdateAbsence web service, and that web service runs to completion over two or three minutes, however the actual console application appears to be timing out after 100 seconds and therefore reporting a timeout error.

Can anybody advise how to change the timeout for the console application (not for the web service)?

Thanks.

Upvotes: 1

Views: 1034

Answers (1)

suff trek
suff trek

Reputation: 39767

Web Service proxy class that in your console application is used to call the webservice has Timeout property. You can set that value in milliseconds,

For example

wscall.Timeout = 300000

Will set the timeout to 5 minutes. Just set this property before call to

wscall.UpdateAbsence()

And your call will use the bigger timeout

Upvotes: 1

Related Questions