Reputation: 7029
I am wondering what the consequences are for a WCF server when the client aborts the connection. I know, for instance, that the server will continue processing the request. But what happens after that? When the server tries to send the response to the client what will happen?
In my case I am using an HTTP binding. Is it different for other bindings? Also, when I say the client aborts the connection I am talking about something like calling client.Abort();
. Does it change anything if the client connection is 'abnormally' aborted, e.g. I unplugged the network cable from the client machine?
Upvotes: 0
Views: 112
Reputation: 654
Assuming you are talking without callback functionality here: There will not be any exception on server if the client is disconnected from server. If the server service is running on perclient mode then the service object will not be destroyed immediately. In percall mode, you can implement IDisposable to clear any resources immediately after the call is over as the object is going to be destroyed. There are no retry methods on the server to keep trying to send the data to the client as the channel between the client and server will be broken.
In callback mode, you will have the client channel and you can check if the client is connected or if you tried to use the channel it will through an exception. You can then remove the channel from the list as you can call again on faulted channel.
If the service is running in percall mode, then do not call client.abort() as that will create another instance of the service. So it is not useful in this mode.
Upvotes: 0