.NET APIs for window service

I tried run the example project "DataApiUsageExampleRealtimeData", everything is fine, but I rewrite it into window service, nothing was trigger in the "DataReceived" action.

singleRequest = realtime.Request("GBP=", "BID", DataReceived); 
singleSubscription = realtime.Subscribe("EUR=", "BID", DataReceived);

is this API can use in window service.??

Thanks for the answer.

Best Answer

  • Eikon .NET API was not designed for and has never been tested in Windows service applications. By design it has runtime dependency on Eikon application, which can only be used in interactive Windows station. You can try using this API in a Windows service, but there's no guarantee it will work. At the very least the service must be run in the context of the user's account who previously interactively launched Eikon, signed in and checked "Sign me in automatically" checkbox. There's absolutely no chance you can successfully use Eikon .NET API in a service run with LocalService, NetworkService or LocalSystem accounts. And even then I can foresee a bunch of issues that might prevent the service from being able to retrieve data from Eikon. Long story short you're better off not using Eikon .NET or COM APIs in Windows service applications.

Answers

  • @theprogrambug Would you tell me please why you would need the API running as a windows service? What is your use case?

  • Hi,

    Me also getting same issue. When running this code in windows service datareceived event not firing. I tried by platform target x86, allow desktop interaction to windowsservice, but no luck. please reply asap, struggling from last week.

  • the desktop application is easily close by user mistakenly, so it is better not showing the interface.

  • Thanks Alex, seems I better using desktop application

  • For this purpose I would suggest a GUIless console application to be run in interactive Windows station rather than a Windows service.