We're trying to run R.net from an ASP.Net webpage in IIS, but encounter the problem that the R engine can't access external libraries. I know this is a common problem, but the typical solutions haven't worked when it comes to IIS (only IIS express from inside VS).

For example, when trying to use 'colorRampPalette' in R which relies on a DLL, the following error message appears:

"Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Program Files/R/R-3.4.2/library/stats/libs/x64/stats.dll': LoadLibrary failure: The specified module could not be found."

It is not the stats.dll that is the problem, but rather another DLL it references.

Now, using the function in R works fine. Using the function from R.net in VS debugging works fine. However, running it from IIS does not work. Normally, it's just a path variable missing to get it to work, but this doesn't seem to be the case here.

What we've tried:

* Ensured that the PATH variable has the necessary folders (i.e. C:\Program Files\R\R-3.4.3\bin\x64 etc). If this was wrong then R.net wouldn't work locally, and I've also verified that IIS doesn't reset the PATH variables which has been pointed out in other sources. When I check the PATH variable from inside IIS the necessary folders are listed.
* Checked that the library, home and bin path in R.net is correct when running under IIS.
* Ensured that the IIS\_IUSRS user has read/write access to the necessary folders and files.
* Verified that the R code is correct.

It seems that this is a common problem, but most solutions refer to making sure the PATH variable is correct, which simply isn't enough in this case.

We're running (Amazon web service):
Windows Server 2016 x64,
IIS 10,
R.NET 1.7,
C# 4.5.2,
R 3.4.2

I've also tried on another (non-AWS) server with a similar setup.

Any ideas of what can cause this? Since a lot of people have issues with R.Net and IIS I suspect someone encountered the same problem where the PATH variable wasn't enough?