C# RDotNet Fails in DLL (WCF) Backend But Runs Fine on Front-End

40 views Asked by At

I have the following simple code that runs fine in front-end. However, if I put the same code in a WCF DLL, then error occurs that reads: "SetCachedEnvironmentVariables requires R path and home directory to have been specified or detected". Apparently, in the DLL, somehow the R path and R home get lost. Note that both front-end and back-end are on the same machine.

REngine.SetEnvironmentVariables();
rEngine = REngine.GetInstance();
rEngine.Initialize();

If I try any arguments into the call like this:

REngine.SetEnvironmentVariables(@"c:\Program Files\R\R-4.3.1\bin\x64", "c:\Program Files\R\R-4.3.1");

Then the DLL dies on the next call GetInstance().

Any help is appreciated.

0

There are 0 answers