I have a Web Application running in one machine and the services in another machine (i.e.both are in different App domains). I have a workflow service in my service layer which
The synchronization context is usually created by some kind of framework, such as ASP.NET, WPF, WinForms, etc. It sounds like when you're running your services in their own process you're not using any kind of framework which would do this.
It's also worth mentioning that SynchronizationContext.Current usually only returns the synchronization context of the current thread, so if you are calling it from the wrong thread it will almost certainly return null.
If you don't have a synchronization context available, you can always create your own. This article explains how:
Synchronization Contexts in WCF
I solved it by overiding the synchronization context
if (syncContext == null)
{
SynchronousSynchronizationContext sync = new SynchronousSynchronizationContext();
syncContext = sync;
}
class SynchronousSynchronizationContext : SynchronizationContext
{
public override void Post(SendOrPostCallback d, object state)
{
this.Send(d, state);
}
}