none
WCF Service to return a status code, terminate the thread, but then continue processing RRS feed

  • Question

  • I have a WCF Service that needs to return a status code to the client, terminate the thread with the client, but then take the data inputted from client and process it. This process can take up to 15 minutes. The data is then returned to a SQL DB where the client can pick it up at another time. I am looking for direction on how to set up the WCF Service to do this - the biggest issue I am having is the termination of the thread and having the service continue processing. In my research I have come across suggestions for using Windows Workflow Foundation or separate threading. Thoughts???
    Friday, October 19, 2018 12:15 PM

All replies

  • Hi Chantilly,
    As far as I know, if there is a relationship between the operation on the client-side. I think we could use the WCF Session mode, which enable the client share the data in the same conversation. Client could control the start and the end of the Session explicitly by the following code.
        [ServiceContract(SessionMode=SessionMode.Required)]
        public interface IService
        {
            [OperationContract(IsInitiating=true,IsTerminating=false,IsOneWay=true)]
            void Start();   
            [OperationContract(IsInitiating =false,IsOneWay =true,IsTerminating =true)]
            void End();
    }


    Here is official document, wish it could give you some inspiration.
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/sessions-instancing-and-concurrency
    Best Regards
    Abraham
    Monday, October 22, 2018 2:28 AM
    Moderator
  • Thanks. I am looking into it and will let you know if I have success.
    Thursday, October 25, 2018 6:16 PM