So I have a WCF service that seems to work perfectly in a deployed production environment. My build intermittently fails though dur开发者_如何学编程ing the unit testing of this WCF service. The weird part is that it's not always the same unit test, but it is always a unit test which uses the WCF service.
Exception:
System.ServiceModel.FaultException[System.ServiceModel.ExceptionDetail]: The number of bytes available is inconsistent with the HTTP Content-Length header.  There may have been a network error or the client may be sending invalid requests.
The weird part is that the exception really only happens on the build machine and never on a developer machine. And it seems to only happen about 75% of the time.
WCF isn't my strongest aspect of .NET so any help pointing me in the correct direction would be useful.
This issue ended up being that inside a catch clause we had:
var proxy = new WcfProxy();
try
{
  // Do something.
}
catch (Exception ex)
{
  proxy.Close();
  throw;
}
Where the catch clause should have used proxy.Abort() as Close() can throw another exception.
catch (Exception ex)
{
  proxy.Abort();
  throw;
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论