Search code examples
c#rwcfr.net

Cannot use r.net within a wcf service


I am trying to set up an R.net WCF service as a server to run R commands on.

I have set up a test WinForms application where everything works.

This is how I use it:

void init()
{
    SetupPath()
    engine = REngine.GetInstanceFromID("test");
    if (engine == null) engine = REngine.CreateInstance("test");
    engine.Initialize();
}
...
    results.Add(engine.Evaluate(command).AsCharacter().ToArray());

I created an equivalent WCF service which should work exactly the same;

REngine.CreateInstance() returns a valid REngine object,
engine.Initialize() silently crashes my service. Try-Catch section is ignored so I cannot see what exactly is happening.

  • What is the correct way to use R.net within a WCF service?

  • What could be the reason of different behaviours?

  • Where can I see detailed logs of the crash?

  • Service calls which don't use R.net complete successfully.

Both winforms test application and WCF service are 64 bit (i need them to be). (I did not manage to set up a 64-bit IIS express application, so am using IIS instead).


Solution

  • I did not manage to find the reason of the problem, however, switching to R.NET.Community package did the trick.