I suppose you could do this by starting a new topic as soon as the WCF operation starts. The real work then happens in a new thread, and the original WCF request stream expects to use Thread.Join () with a specific timeout. If a timeout occurs, the workflow can be canceled using Thread.Abort ().
Something like that:
public string GetData(int value)
{
string result = "";
var worker = new Thread((state) =>
{
Thread.Sleep(TimeSpan.FromSeconds(value));
result = string.Format("You entered: {0}", value);
});
worker.Start();
if (!worker.Join(TimeSpan.FromSeconds(5)))
{
worker.Abort();
throw new FaultException("Work took to long.");
}
return result;
}
source
share