Iain
Iain

Reputation: 45

Capture Third Party DLL events in WCF

I’ve been supplied with a DLL by a third party which processes the data it’s supplied and returns its results through an event as below.

private IBlackbox blackbox;

// Capture the processed data from the BlackBox
public void blackbox_Processed(object sender, BlackBoxEventArgs e)
  {
    string returndata = e.ReturnData;
    // Do something with the data
  }

public void blackbox_Run(string datavalues)
  {
    blackbox.Processed += new EventHandler(blackbox_Processed);
    blackbox = BlackBox.Create(datavalues);
    blackbox.Start(); 
  }

This implementation works fine when called from a Windows form with the blackbox.Processed event firing in less than a second. However, when I implement this in a WCF method the blackbox.Processed event is never trapped.

Can anyone help?

Upvotes: 3

Views: 189

Answers (1)

chris.house.00
chris.house.00

Reputation: 3301

It's hard to say for certain since you haven't provided code for your service but my guess is that the call to your service method is returning before your blackbox component fires the event. One thing you could look at would be using a WCF duplex service which would allow you to publish an event from the server to the client.

WCF Duplex Services

Upvotes: 1

Related Questions