Reputation: 221
I have a One way WCf Service which will just log entries in database.Normally it will run for 10 - 20 mins . Is there any way to cancel the service when any need arises ?
On button click i'l be triggering the one way WCF service . Now m planning to add cancel button which should stop currently triggered service. Could anyone help me in achieving this.
Upvotes: 0
Views: 88
Reputation: 686
You can either make the operation IsOneWay, or implement the asynchronous pattern. To prevent threading issues, consider using the SynchronizationContext. Programming WCF Services does a great job at explaining these.
You can even consider using a BackgroundWorker.
Here is a nice Guide regarding Async and Sync calls: http://www.codeproject.com/Articles/91528/How-to-Call-WCF-Services-Synchronously-and-Asynchr
Upvotes: 1