Solved

C# Web Service timeout

Posted on 2007-11-20
8
12,059 Views
Last Modified: 2013-11-07
Hi,

I created a console application to load test my web service. I created 10 threads that I execute at the same time.

Each web service thread queries a database with a query that takes 2-3min.

When I start the 10 threads and wait for around 5min, my testing programI gets a time out exception:

System.Net.WebException: The operation has timed out
   at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
..
..

Is this normal? Is it possable to extend this timeout in the web service?

Thank you! :P
0
Comment
Question by:Endelm
8 Comments
 
LVL 40

Accepted Solution

by:
evilrix earned 125 total points
ID: 20320473
0
 
LVL 21

Assisted Solution

by:surajguptha
surajguptha earned 125 total points
ID: 20320475
Check this article about increasing timeouts
http://www.thescripts.com/forum/thread628561.html
0
 
LVL 7

Assisted Solution

by:badbearontour
badbearontour earned 125 total points
ID: 20320780
Theres a possible change tot he webconfig file you could try. its detailed here

http://www.sitepoint.com/article/web-config-file-demystified

its something like application_timeout.

its usually set at 5 mins, you oculd try ectending it.

In reality though I would probably try using asynchronous calls to the webservice, as 2-3 minutes is a long time for a query to run

Good Luck

BB
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 7

Expert Comment

by:badbearontour
ID: 20320789
Sorry its called

   <httpRuntime appRequestQueueLimit="100" executionTimeout="600" />

BB
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20321211
Um, all of which is documented in the very first link to that I posted -- in detail!
0
 
LVL 37

Assisted Solution

by:gregoryyoung
gregoryyoung earned 125 total points
ID: 20321894
I think a better question is what on earth are you doing in a webservice call that takes 5 minutes?!?!?!

I think you may be looking at a bad architecture here ... This sounds like something that should be done asynchronously i.e.

I call the WebService to request this thing to be done ...
The webservice writes the job say to a table returns me a unique ID of the task I just requested ... (it is telling me that the task will be run in the future).
Another process picks up the job out of that table and processes it (setting when it is completed)
I can then ask the webservice the status of the task *OR* I can tell the webservice a local webservice where it can call me to tell *me* that the task has been completed ...
I ask the webservice for the results (or this is combined with it telling me the job is done)


This introduces queuing to the system and allows it to be processed by some other back end processor. This is important because what happens if the webservice restarts? The tasks will still run .... if the back end processor is restarted it will continue working where it left off.

What happens if 500 calls are made concurrently (this could qualify as a DoS attack) haviong the webservice do this directly would be a disaster (500 concurrent tasks). The queuing here limits the number of concurrent jobs to be run (it is simply a configuration point of the back end processor).

The queuing provides a full transactional log of every request that has been processed (and could even link to the results returned) ... not a big deal to implement otherwise but it comes for free ...


0
 
LVL 1

Expert Comment

by:Computer101
ID: 20521763
Forced accept.

Computer101
EE Admin
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question