WPF and WCF with Named Pipes

203 views Asked by At

The following code works just fine in WinForms:

if (System.Configuration.ConfigurationManager.AppSettings["Data.UseNamedPipes"] == "true") 
{
      AES.Cloud.DataAccessLayer.TheEDGEContext.UseLocalDb = true;
      string address = "net.pipe://localhost/" + Guid.NewGuid() + "/DataManager";
      var svc = AES.InProcFactory.CreateInstance<AES.Cloud.DataService.EstimatingDataService, AES.Cloud.DataService.IDataManager>(2147483647, 2147483647, address);
      DataService<AES.TheEdge.Framework.Services.Contracts.IDataManager>._namedPipeAddress = address;
      var ss = svc.GetNextKey();   //<-- Calling service here.
}     

but when I use WPF it times out (exception at the bottom but it's useless) when I call the service, however if I invoke this code on a different thread it works just fine in WPF:

System.Threading.ThreadPool.QueueUserWorkItem( new System.Threading.WaitCallback( (o) =>{

    //same code as above...  no problem, no timeout, no blocking 
}

Is there some issue using the startup/main thread to do this sort of thing? Confused in Jupiter...

Exception:

System.TimeoutException: This request operation sent to net.pipe://localhost/c1a59720-11fc-49c3-9d82-8185203a6f5d/DataManager did not receive a reply within the configured timeout (00:01:00).  The time allotted to this operation may have been a portion of a longer timeout.  This may be because the service is still processing the operation or because the service was unable to send a reply message.  Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client.
0

There are 0 answers