Setting web service timeout in vb.net

B

Bob Connolly

This link references asp.net. I am not using asp.net. I am accessing a web
service in a windows console program and it keeps timing out. I have read
that the default is 100 seconds. I want to increase this. What is the syntax
that I should use in my program to do this?
 
C

Cor Ligthert[MVP]

Bob,'

A webservice = aspnet.

If you want to do this in a windows form, than don't talk about a webservice
timeout.
Steve gave you a very nice answer, on something that you were not asking.

Your question is to unclear to give a full answer, however probably you can
let your thread sleep a while.

Cor
 
B

Bob Connolly

I apologize for not being clear enough in my question. I am still learning
about web services and it is sometimes hard for me to formulate questions
correctly. Please allow me to elaborate more: I have a vb.net windows console
program running on my pc that is serving as a client to pull down information
from a web service on a server. To do this I first added a Web reference (in
Solution Explorer) which I called AmiClmSvc_WebService (setting the Web
Reference URL property to point to the WSDL on my server with the web
service). Then in my code I have:

Dim AmiClmSvc_Proxy As New AmiClmSvc_WebService.AmiClmSvc

Then later I have:

Dim AmiClaimSummary_Result As Object
AmiClaimSummary_Result =
AmiClmSvc_Proxy.AmiClaimSummary(SelectDate.ToString, SelectDate.ToString)

On this last step I am getting a timeout after 100 seconds, which I have
read is the default setting. I need to change the timeout value to something
higher than that, but do not know what syntax I need to use in order to do
that.

Can anyone help me with this?
 
B

Bob Connolly

Right, I have tried typing something like:

AmiClmSvc_Proxy.timeout = 5*60*1000

When I do this, there are no intellisense options and when I am done it
gives me a syntax error: "Declaration expected"

What syntax do I need to use to set the timeout?
 
B

Bob Connolly

When I put this stement in my program as is it gives me the "Declaration
expected" syntax error. Could you please elaborate a little more? Where would
I put this statement? How will this increase the timeout period? Please keep
in mind that I am very new to the use of web services.

Thank you!
--
Bob Connolly


Cor Ligthert said:
Bob,

Why not simple
\\\
Threading.Thread.sleep(100000)
///

-Cor
 
B

Bob Connolly

In the previous post you say:

Maybe that should be
Dim AmiClmSvc_Proxy As New AmiClmSvc_WebService

When I try this I get a syntax error on AmiClmSvc_WebService that tells me
"Type Expected"

What else do you suggest?
 
B

Bob Connolly

I was finally able to resolve this issue, though I do not fully understand
why. When I originally coded as you suggested:

AmiClmSvc_Proxy.Timeout = 60 * 60 * 1000 '60 minutes

I got the errors that I described where I was not getting intellisense and
syntax error: "Declaration expected". I was coding this statement at the
Module level directly under the dim statement where I defined the
AmiClmSvc_Proxy in the first place. I was finally able to resolve the issue
when I coded the above statement within a SUB within the module. Suddenly the
intellisense started working and the timeout was changed. I don't understand
why the statement would work in one place and not the other, but it does.
Perhaps you can explain why? In any event, it is working and I thank you for
your help.
 
A

Alex Novosad

Cor,

Please go back to school before you start offending other posters like Bob. I have no idea how you got your MVP or in what area your MVP is in, but I can tell it's not in .NET. "A webservice = aspnet" is an absurd statement. .NET Web services can be accessed from anywhere with anything and on any platform as long as that anything runs .NET. You can even call a web service from managed SQL since SQL 2005 came out, and you could call Web services from Windows Application since the beginning of .NET.

Bob, your question was 100% valid. To set timeout on a web service, first instantiate that web service. Let's say you called your web service MyFunkyService when you added Web Reference to it to your project. Then you'd instantiate it like this:

Dim myServiceInstance as New MyFunkyService.MyFunkyService

"MyFunkyService" repeats twice because by default when you add a web service, a proxy class is created and placed in the same namespace as class itself, so the first "MyFunkyService" refers to the namespace while the second one - to class name.

To set timeout to, say, 360 seconds, write:

myServiceInstance.Timeout = 360000 'in milliseconds

I think you're right that default is at 100 seconds or 100000 milliseconds.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top