Search code examples
c#.netwcfwcf-client

WCF service instance will not close despite only calling oneway method


I have a WCF service running inside a windows service on a remote machine. In the WCF service's contract, I have a method that takes a long time to run set up as

[OperationContract(IsOneWay = true)]
void Update(myClass[] stuff);

Everything works fine, the method gets called, I can see what it needs to do start getting done.

The problem is when I go to close the instance of the WCF service in my code, it times out and I get:

The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:02:00'.

I thought the one way contract allowed me to fire and move on. Is there something I am missing? If not are there workarounds for this?


Solution

  • Your "Update" is a method on the service.

    When you open the wcf client, a connection to the service remains open until you call Close (or Abort).

    You are probably not calling close, and it is therefore remaining open until it timesout.