Reputation: 16541
My application is running whole night and at random times it gets disconnected, on the other hand on some nights it does not.
This is the exeption in Visual Studio, it gets stuck in here.
This is the info it gives about my WebRequest
.
This is the info it gives about the exception on response.
What I am thinking, is that it is not my bug, sometimes really server does not answer me and it is giving me this exception. If you agree, how would it best to handle this kind of exception. Should i just wrap my 3 using
statements into try catch?
Upvotes: 0
Views: 112
Reputation: 98746
Yup, try-catch is the way to go for unreliable web services (and perhaps a loop to try again a limited number of times).
Note that you can stack your using
statements this way to avoid all the indentation:
using (...)
using (...)
using (...) {
// Do stuff...
}
Upvotes: 1