Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 244137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:58:46+00:00 2026-05-11T20:58:46+00:00

I have created a test service with a method that contains a very long

  • 0

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.

Is there way to stop it? Without changing the method code?

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.


  // 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 < 1000000; i++)
         {
            Trace.WriteLine("Processing " + i.ToString() + " Thread ID " + id.ToString());
            Thread.Sleep(1000);        
         }
      }
   }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:58:47+00:00Added an answer on May 11, 2026 at 8:58 pm

    I don’t think that this is possible without modifying your existing code.

    Take a look here and here. The thread servicing the request is totally decoupled from the part of WCF which delivers the results to the client.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service that I created in C# and a test harness
I have a web service I'm trying to load test. I created a program
I have created a Visual Studio 2008 sp1 test suite web test that uploads
I've created some MbUnit Test Fixtures that have SetUp methods marked with the SetUp
I have created a custom SharePoint web service that was deployed to, and successfully
I have created a PHP-script to update a web server that is live inside
I have a little JUnit-Test that export an Object to the FileSystem. In the
I have a web service that I can only hit if I'm logged into
I have a suite of web tests created for a web service. I use
I have the following web service method (.ASMX file): [WebMethod(EnableSession = true)] [ScriptMethod(ResponseFormat =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.