This might be discussed elsewhere but I can’t find it. I have a .Net Web Service that has a function that loops through a date range and runs calculations and updates records in a database. If you give this said function a long date range, it can take quite some time to complete. This being the case, I need a way to stop this function.
Is there a way of making the web service function call run in a identified thread so that I can cancel that thread if need be? Or am I over or under thinking this? I am using C# .Net Web Page with jQuery to perform the AJAX calls to the web Service function. Any help will be greatly appreciated.
Add a Cancel() method to your web service that sets a state variable. Then, simply have your long running operation periodically check this variable and stop if its set (with appropriate protection, of course).