How to correctly open WCF service -


I am using WCF client like this ...

  var client = New test client (); Try {response = service.Operation (request); } Finally {try (client.State! = CommunicationState.Faulted) client.Close ();} Hold (exception) {client.Abort ();}}  

But time At the time, I get 500 HTTP error, which is the only answer for the next 15 minutes, then everything becomes normal for 15 minutes and so on.I know that there are some load balancing stuff in loading the service , But people can not find any problems with it.

That is why I am surprised that I When I was using "experiment" to stop the service connection, then I have already made a mistake and I am afraid that I am doing something wrong.

< P> Can anyone say that whether my method of calling WCF service is correct or not (most rare occurrences) in events?

I recommend:

  var client = new test client (try) {try} = Customer. Operation (request); client.Close ();} hold {client.Abort ();}  

The way you are doing, if you get something wrong So you are not being canceled, because your hold is finally inside the block. If you want to use today's code, I think you need to convert it to:

  var client = new test client (); Try {feedback = customer. Operation (request); } Finally {try (if (client.State! = CommunicationState.Faulted) client.Close (); Other clients. // If the state has been defective then stop it.} Hold (exception) {client.Abort () ;}}  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -