Hi cj2,
Yes, there is a way to set the timeout. But the approach differs from the
legacy SoapHttpClientProtocol client and the WCF client.
I'm going to explain both ways.
If you're using the SoapHttpClientProtocol client (in your project, the
reference to the Web Service is under the *Web References* folder):
You can just set the timeout value via the Timeout property.
For example:
Dim svc As New localhost.Service1 ' <- this is my web service reference
svc.Timeout = 5000 ' <- timeout after 5 seconds
MsgBox(svc.HelloWorld()) ' call the HelloWorld method on the service.
Just like Mr. Arnold said, but the Timeout value unit is milliseconds, not
seconds.
If the web service took more than 5 seconds to return the result, a
WebException will be raised on your windows application side with a message
"The operation has timed out".
Setting the Timeout property to Timeout.Infinite indicates that the request
does not time out. Even though an XML Web service client can set the
Timeout property to not time out, the Web server can still cause the
request to time out on the server side.
For more information, please refer to:
http://msdn.microsoft.com/en-us/library/system.web.services.protocols.webcli
entprotocol.timeout.aspx
***************
If you're using the WCF client (in your project, the reference to the Web
Service is under the *Service References* folder):
You can config the timeout in the app.config, where you can find a <binding
.. /> section, there is a sendTimeout attribute indicating the timeout
value. The default timeout value is 1 minute.
For more information, please refer to:
http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpbinding
.aspx
***************
Also, you can config the timeout on the Web Service side (server side) by
configuring <httpRuntime ... executionTimeout />.
For more information, please refer to:
http://msdn.microsoft.com/en-us/library/e1f13641.aspx
Hope these information helps.
If you need further assistance, please kindly let me know.
Best regards,
Jie Wang
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.