title: CommunicationObjectAbortedException occurrs when WCF Client waits for an asynchronous return from self hosted service
body: <p>I have a WCF client that creates a self hosted service. The client will eventually host other service endpoints, so the client maintains a list of service references locally, m_services, and invokes the service methods on each endpoint maintained.  The ServiceHost is created, and the client is created at the endpoint.  A few setup calls are made to the service succesfully.</p>
  
  <p>Another call to the service is made, which returns quickly, but then the client waits for an asychronous return to a callback delegate. There are numerous callback calls that are made, about 1 a second over about a 5 minute period, waiting for a specific callback method with data passed in.  </p>
  
  <p>While the client is waiting for a response, I eventually get the following exceptions to my output console.</p>
  
  <p><code>A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
  A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
  A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.Runtime.DurableInstancing.dll
  A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.Runtime.DurableInstancing.dll
  A first chance exception of type 'System.ServiceModel.CommunicationException' occurred in System.Runtime.DurableInstancing.dll</code></p>
  
  <p>Below is the code that I use to build up the ServiceHost for the self hosted service. Am I doing something incorrectly with setting up my ServiceHost and client? I'm not sure why initially, the client is responsive to calls and gives expected results, but eventually gets faulted and the communication object is aborted.  Initially I had the ServiceHost as a local variable to the method that was creating it, but promoted it to a field of the class, thinking that it might have been garbage collected.</p>
  
  <pre><code>m_selfHost = new ServiceHost(hostType);
  var binding = new WSDualHttpBinding();
  ContractDescription contractDescription =
      ContractDescription.GetContract(contractType);
  EndpointAddress endpointAddress = new EndpointAddress(Properties.Settings.Default.SelfHostedServiceUrl);
  ServiceEndpoint endpoint = new ServiceEndpoint(contractDescription, binding, endpointAddress);
  m_selfHost.AddServiceEndpoint(endpoint);
  
  DllAnalyzerServiceClient service = new DllAnalyzerServiceClient(m_instanceContext, binding, endpointAddress);
  m_selfHost.Open();
  service.Subscribe();
  service.DynamicallyLoadDll(crxDllFile);
  m_services.Add(service);
  </code></pre>