Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to stop exution of a method call in WCF after a transaction timeout
    primarykey
    data
    text
    <p>I have created a test service with a method that contains a very long loop. I was hoping that when a timeout transaction occurs, the method execution will flush, but it doesn't. The client gets a timeout, but the processing continues on the server. </p> <p>Is there way to stop it? Without changing the method code?</p> <p>Here is the example: in the example I call the method QueueRequest using queue binding, and after 10 seconds the transaction is aborted. At this point a retry occurs, causing the same issue. After a few retries the server is doing 100% cpu work trying to ran the loop on multiple threads / instances even if the message is poison and dropped.</p> <hr> <pre><code> // NOTE: If you change the class name "Service1" here, you must also update the reference to "Service1" in App.config. [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall, TransactionTimeout="00:00:10", ReleaseServiceInstanceOnTransactionComplete=true)] [ErrorHandlingBehaviorAttribute] public class Service1 : IQueueService { public Service1() { Trace.WriteLine("Creating an instance on thread " + Thread.CurrentThread.ManagedThreadId.ToString()); } ~Service1() { Trace.WriteLine("Destroying an instance on thread " + Thread.CurrentThread.ManagedThreadId.ToString()); } [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)] public void QueueRequest(string message) { int id = Thread.CurrentThread.ManagedThreadId; Trace.WriteLine("Got Message on thread " + id.ToString()); for (int i = 0; i &lt; 1000000; i++) { Trace.WriteLine("Processing " + i.ToString() + " Thread ID " + id.ToString()); Thread.Sleep(1000); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload