Question: Good day!

I have simple wcf service and desktop client,wich uses some functions.
But my client fault with exception that my wcf operation goes too long.

Some code:

```
 client=new MyWcfServiceClient();
 client.DoWork(param1,param2..etc);

```

I dont need to wait while DoWork do work. I need to execute this method and go forward. It is like send command to do some work and i dont need to get result immediately.

How to do that?
Thank you!

P.S. server side code looks like:

```
 DoWork(param1,etc)
   {
   // do long-term work at same thread
    }

```

P.P.S. i ingnore the result.

Answer: 
On the service, move your logic from: DoWork(param1, etc) to another method e.g. DoWorkBackground(...)

```
static Task _backgroundTask;

void DoWork(param1, etc)
{
    if (_backgroundTask == null || _backgroundTask.IsCompleted)
        _backgroundTask = System.Threading.Tasks.Task.Run(
                                                () => DoWorkBackground(param1, etc) );
}

void DoWorkBackground(param1, etc)
{
    //long running logic
}

```
If you can modify your DoWork operation, define it as OneWay, so it will return immediately. If DoWork is a web service, the HTTP code 202 will be returned.