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.