Edit / Foreword: this answer assumes that you want to use WCF only for user interaction with the process, and not for linking the entire software stack, and that the main work is done using the longest maintenance.
Yes, this can be done in WCF, and this is probably the right solution. You will have a long processor thread that often requests / updates a certain set of interaction properties (for example, it will update the percentage that it does, which element it works, and check the pause flag, etc.). These properties, in turn, will be requested / set using the WCF interface methods.
The syntax template is ideal for this - if your stream setting is configured correctly, users will interact with some properties that check for a long stream (or streams).
From an extremely high level point of view, the processor class will probably look something like this (in principle, how can this be done, donโt do it exactly like that, otherwise I will have nightmares):
// IWcfProcessor is the ServiceContract interface // Processor runs as a singleton and does (or has a thread that does) the processing work class Processor : IWcfProcessor { public Processor() { new Thread(Process).Start(); } public void Process() { while (Run) { // Do long-running process stuff, update some tables PercentDone += 0.1; } } public decimal PercentDone { get; set; } public bool Run { get; set; } /// WCF method defined in IWcfProcessor public void SetState(bool state) { Run = state; } /// WCF method defined in IWcfProcessor public decimal GetStatus() { return PercentDone; } }
You can then connect to the IWcfProcessor
from the endpoint of the network or application.
In addition, I may run into problems, for example, if one user tried to start / stop the import process at the same time, etc.?
Assuming that you have correctly configured thread switching, you will have no problem.
Is the application a singleton to make sure everyone works with the same single import process?
Yes, that's great.