If you create an ASP.Net project (MVC/WebAPI2), R will appear to load and function properly if you try executing simple code:
x <- 4 + 4
print(x)
will output 8.
However, if you try an external function such as the `summary` function located in stats.dll you get an error message.
print(summary((1:5))
*Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Program Files/R/R-3.1.0/library/stats/libs/i386/stats.dll': LoadLibrary failure: The specified module could not be found.*
Since the "stats.dll" is located in that folder, I assumed that the error was due to security permissions/configuration under IIS.
Typical troubleshooting steps do not resolve the issue:
- Make sure the asp.net application can run at "FullTrust" so it can load the unmananged assemblies.
- Ensure the the AppPool user account, or the IIS_IUSRS group has a minimum of read/load permissions on the R folder tree.
- Try running the AppPool as a local user account, instead of one of the synthetic IIS_IUSRS accounts.
While looking at the iisexpress process under `procmon`, I noticed that the "stats.dll" was being loaded properly, but the stats.dll was trying to load Rlapack.dll which is located in the R architecture bin folder. LoadLibrary will search the current folder (the stats.dll folder), and the search paths, but unless the R architecture bin folder is on the search path, the Rlapack.dll will not load, and R will return an error.
Adding the architecture bin folder to the path fixed the issue for stats. In my case, that was
C:\Program Files\R\R-3.1.0\bin\i386
I also believe that pulling the R binaries into the IIS virtual folder path will resolve the issue, but I have not verified it.
Another good test, is plotting from the DAAG library. This example would fail to load the lattice package before the path change:
library(DAAG)
#Good example. Dashed pen. Clipping. Cooks distance?
mf <- lm(log(timef)~log(time), data=nihills)
plot(mf, which=5)
but works properly now. See attachment.
Comments: Absolutely. I have a couple of smaller PR's to submit also, including some a sample for the graphics device.
x <- 4 + 4
print(x)
will output 8.
However, if you try an external function such as the `summary` function located in stats.dll you get an error message.
print(summary((1:5))
*Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Program Files/R/R-3.1.0/library/stats/libs/i386/stats.dll': LoadLibrary failure: The specified module could not be found.*
Since the "stats.dll" is located in that folder, I assumed that the error was due to security permissions/configuration under IIS.
Typical troubleshooting steps do not resolve the issue:
- Make sure the asp.net application can run at "FullTrust" so it can load the unmananged assemblies.
- Ensure the the AppPool user account, or the IIS_IUSRS group has a minimum of read/load permissions on the R folder tree.
- Try running the AppPool as a local user account, instead of one of the synthetic IIS_IUSRS accounts.
While looking at the iisexpress process under `procmon`, I noticed that the "stats.dll" was being loaded properly, but the stats.dll was trying to load Rlapack.dll which is located in the R architecture bin folder. LoadLibrary will search the current folder (the stats.dll folder), and the search paths, but unless the R architecture bin folder is on the search path, the Rlapack.dll will not load, and R will return an error.
Adding the architecture bin folder to the path fixed the issue for stats. In my case, that was
C:\Program Files\R\R-3.1.0\bin\i386
I also believe that pulling the R binaries into the IIS virtual folder path will resolve the issue, but I have not verified it.
Another good test, is plotting from the DAAG library. This example would fail to load the lattice package before the path change:
library(DAAG)
#Good example. Dashed pen. Clipping. Cooks distance?
mf <- lm(log(timef)~log(time), data=nihills)
plot(mf, which=5)
but works properly now. See attachment.
Comments: Absolutely. I have a couple of smaller PR's to submit also, including some a sample for the graphics device.