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

  • SEARCH
  • Home
  • 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 7672819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:22:22+00:00 2026-05-31T16:22:22+00:00

I have a well defined service contract which exposes a bunch of methods. We

  • 0

I have a well defined service contract which exposes a bunch of methods. We have a typical service implementation of this contract which is hosted within IIS 7 along with our MVC App.

The architecture is of a typical distributed application with the interface defined in a base core library (which is re-distributable), the implementation within an independent services library and finally the MVC App exposing an end-point for the implementation(which is within the services library).

The situation now is that one of these existing service methods needs to possibly execute a logical process which can take upto 10 minutes to execute. In a normal scenario we would have considered workflow services but the interface under question is well in use, we have a suite of unit tests to test our services etc. and we really can’t get away with this implementation that we have.


So my questions are –

  1. Is it possible to have an independent workflow which can do this long running process and call it from our WCF service?
  2. If it is then how do I ensure that the worker thread executing my service within IIS will stay alive for the duration for the workflow?
  3. Finally the client does not need to wait for a response from this service. It is a fire and forget method. Can the client call end immediately while the service kicks off a workflow and waits for it to finish?
  • 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-31T16:22:23+00:00Added an answer on May 31, 2026 at 4:22 pm
    1. Sure. In your WCF service you’ll use a WorkflowApplication to execute your workflow definition. This will take care of executing/tracking each WF instances with the WF runtime on WF runtime specific threads (i.e. not blocking a WCF I/O thread).
    2. There are no guarantees here. If the app pool crashes or is scheduled to shut down due to “inactivity” that will terminate any workflows that are still potentially executing. You will have to use persistence points to ensure that if the WF is terminated you will resume from previous bookmarks.
    3. Yes, first, mark your WCF service method with [OperationContract(IsOneWay=true)]. Second you will use the WorkflowApplication instance from 1 to start the WF using the async BeginRun and, if you care about tracking completion/errors in your WCF service, you can register the necessary Aborted, Completed, Unloaded handlers.

    Here’s a really simple example:

    [DataContract]
    public class MyParametersDataContract
    {
       [DataMember(Order=1, IsRequired=true)]
       public string SomeValue
       {
           get;
           set;
       }
    }
    
    public class IMyService
    {
        [OperationContract(IsOneWay=true)]
        void DoSomething(MyParametersDataContract someParameters);
    }
    
    public class MyService : IMyService
    {
         // Hold your WF definition in a static singleton to reduce overhead of activity realization
         public static readonly Lazy<MyFancyWorkflow> MyWorkflow = Lazy<MyFancyWorkflow>(() => new MyFancyWorkflow());
    
         public void DoSomething(MyParametersDataContract someParameters)
         {
             // Example of translating incoming parameters to WF args
             Dictionary<string, object> workflowInputArguments = new Dictionary<string, object>
             {
                 { "SomeArgument", someParameters.SomeValue }
             };
    
             // Create a WFA instance for this request
             WorkflowApplication workflowApplication = new WorkflowApplication(MyService.MyWorkflow.Value, workflowInputArguments);
    
             // Example of hooking the completed action
             workflowApplication.Completed = (workflowCompletedArgs) =>
             {
                 // do something when workflow has completed
             };
    
             // Invoke the running of the WF asynchronously
             Task.Factory.FromAsync(
                                    workflowApplication.BeginRun,
                                    workflowApplication.EndRun,
                                    null)
                                   .ContinueWith(runAntecdent =>
                                   {
                                      // Observe/log any exception with starting the WF so it doesn't crash the process
                                      Trace.TraceWarning("WF failed to run: " + runAntecedent.Exception.ToString());
                                   },
                                   TaskContinuationOptions.OnlyOnFaulted);
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF application which talks to a WCF service hosted in IIS.
I have some Service class which is defined as InstanceContextMode.Single, and is well known
I have a class which has a well-defined responsibility - to Enrich an object
I have a Web Service ( model-layer ) which communicates with Database. This module
Well i have a gridview where i have defined the columns on my own
Well, the question is kinda simple. I have a object defined as: public class
Well this is weird let me describe the scenario I have this mailer define
well i have a configuration like this in the components part of my config
I have this scenario well, i'll let the model explain. public class ScheduleMonthlyPerDayModel {
I have a MVC application with a Domain Model well defined, with entities, repositories

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.