Linked Questions
75 questions linked to/from What is the best workaround for the WCF client `using` block issue?
1 vote
1 answer
7k views
Best practice to call WCF Service [duplicate]
I have always learned that never use using statement when calling WCF Service like this using (Service.YourClientProxy client = new Service.YourClientProxy()) { var time = client.Time(); } So I ...
0 votes
1 answer
1k views
Disposing of a WCF client instantiated via an interface [duplicate]
I would like some clarity around the following (apologies in advance if this is a stupid question) Am working on some existing code which calls a WCF service. This code instantiates a WCF service ...
66 votes
8 answers
3k views
Is there a situation in which Dispose won't be called for a 'using' block?
This was a telephone interview question I had: Is there a time when Dispose will not be called on an object whose scope is declared by a using block? My answer was no - even if an exception happens ...
75 votes
2 answers
137k views
How to programmatically connect a client to a WCF service?
I'm trying to connect an application (the client) to an exposed WCF service, but not through the application configuration file, but in code. How should I go about doing this?
32 votes
4 answers
33k views
Closing WCF connection
We are using WCF service on the client side we are planning to explicitly close the connection It seems there are more then one way of closing Sample1: In the finally block of the WCF service ...
49 votes
4 answers
30k views
How to handle WCF exceptions (consolidated list with code)
I'm attempting to extend this answer on SO to make a WCF client retry on transient network failures and handle other situations that require a retry such as authentication expiration. Question: What ...
34 votes
4 answers
25k views
ChannelFactory.Close VS IClientChannel.Close
Consider the following code which is typcial of many ChannelFactory examples: WSHttpBinding myBinding = new WSHttpBinding(); EndpointAddress myEndpoint = new EndpointAddress( ConfigurationSettings....
12 votes
3 answers
17k views
How can I make Named Pipe binding reconnect automatically in WCF
I'm writing a service that will only get calls from the local host. Performance is important so I thought I'd try the NetNamedPipeBinding instead of NetTcpBinding and see If I could see any noticeable ...
34 votes
4 answers
14k views
Is WCF ClientBase thread safe?
I have implemented ClientBase to use WCF to connect to a service. I'm then calling a method on the channel to communicate with the service. base.Channel.CalculateSomething(); Is this call thread safe ...
21 votes
4 answers
9k views
Do I have to Dispose Process.Start(url)?
Simple question: I want to open a URL using the Default Browser, so I just do Process.Start(url). However, I noticed that this returns an IDisposable object. So now I wonder if I have to dispose it? ...
6 votes
12 answers
2k views
The scope of C#'s using keyword
I understand that any time I am instantiating a class that implements IDisposable, I should use the using keyword in order to ensure that it's disposed of properly. Like so: using (SecureString s = ...
14 votes
2 answers
19k views
How to heal faulted WCF channels?
When a single ClientBase<T> instance is used for multiple WCF service calls, it can get a channel into a faulted state (ie. when the service is down). I would like to heal the channel ...
10 votes
3 answers
6k views
Problems with the Using Statement and WCF client
I've been wrapping all the code that invoke WCF calls within an using statement in a thought that the object will be disposed properly. When I'm googling for an exception "Http service located at .. ...
6 votes
4 answers
8k views
Dispose a Web Service Proxy class?
When you create and use a Web Service proxy class in the ASP.Net framework, the class ultimately inherits from Component, which implements IDisposable. I have never seen one example online where ...
11 votes
2 answers
21k views
WCF Error The communication object, System.ServiceModel.Channels.ServiceChanne, cannot be used for communication because it is in the Faulted state
We get "The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state." message when we close the application. Can ...