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?
As mentioned by user2967150, It is not the stats.dll that is the problem, but rather another DLL it references.
After doing lot of research I found that It try to find Rlapack.dll in 'C:/Program Files/R/R-3.4.2/library/stats/libs/x64/ path.
so you just have to copy Rlapack.dll from 'C:\Program Files\R\R-3.4.4\bin\x64 \Rlapack.dll'
to 'C:/Program Files/R/R-3.4.2/library/stats/libs/x64/ .
After this the web Application can access external R libraries.
Note: I assume that your web Application Run locally but creates a problem when you try to run it on IIS.
I was solving same issue. For IIS I did not find the solution. I was also debugging the R.NET code, but solution by setting correct path to R folder did not work.
The solution is created additional layer, which cover running R project (actually create own R server). I used self hosted WCF service,
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-host-a-wcf-service-in-a-managed-windows-service
which is practically console application and has benefits application running not in IIS application pool. This solution also cover singleton REngine problem. In case you run the instance or REngine in IIS, there is no posibility dispose it, only by stop application pool. For self-hosted service you can set trigger for restarting application in case memory leak.
During this implementation I discover problem run R.NET again R 3.4.3 in debug mode on console application I get error "The library "..." could not be load", so I used the R 3.4.2. which work nice. 86x installation is required - independent the your application run in 64x/ANYCPU environment.
Have you found any other solution for that?
Related
We have ASP.NET MVC application which is running on windows server machine. I have renamed classes to satisfy sonar scanning. The code deploys and runs without issue locally and in our SIT server. However, it is showing error in UAT server on windows server machine. It shows warning in event viewer that it could not find reference to previously renamed class. I have renamed a class from "CarDTO" to "CarDto", it is still trying to look for CarDTO which does not exists after the rename.
I have tried to do the following but none seems to solve the issue.
Restart IIS
Recycle application pools
Clear asp.net temporary folder
Increase the version in assembly info
I used the same files and dll in both SIT and UAT servers.
Anyone has similar issue and a way to solve this? Thank you.
Thanks for the suggestions. Apparently, there is an extra dll that accidentally being copied to the bin folder. Even though it is not being used, it gets compiled by IIS and complaining that class name mismatched.
I am working on a Service Fabric application that contains a number of stateless services and a single stateful service. When I publish the first time, everything is fine and it's deployed to my local cluster. After this, if I try to package or publish the app without explicitly stopping it first, I get the following error:
CSC : error CS2012: Cannot open 'C:...\ProjectFolder\obj\x64\Debug\ProjectName.pdb' for writing -- 'The process cannot access the file 'C:...\ProjectFolder\obj\x64\Debug\ProjectName.pdb' because it is being used by another process.'
According to process explorer, the PDB is locked by my own ProjectName.exe. This is the single stateful service in my application.
Why would my exe lock its own PDBs? I could understand if it was Visual Studio doing it.
I see nothing in my own code that should cause this, so I'm assuming it's something in the Fabric code I'm calling.
The PDBs are deployed with the application, but it's the files in the original source directory that are locked - why not the PDBs adjacent to the running code?
Why do I only see this error relating to the stateful service, and not the stateless services?
I suspect this has something to do with the stateful service generating lots of errors on startup, which Fabric may need symbols to properly display.
How can I stop it happening - either using the correct PDBs or not using them at all unless I'm debugging through Visual Studio?
Edit: Raised on github. Current workaround for this:
A current workaround at this point in time would be to restrict the Network Service access to the pdb in the build folder (obj\x64\Debug).
Based on the issue that was raised, it looks like this is now fixed.
"Going to close the issue as we believe both issues have now been addressed by the 5.6 runtime and the 1.6 tooling."
Seems upgrading is now the answer to point 4. If anyone can answer 1-3 I'd be very happy to move the big green tick.
I have an error running a asmx WebService that uses asp.net 2.0 on IIS 7.5. The webservice calls a method from a dll using the Dllimport call. The point where the call is made is where the error happens. However I get no exceptions, just ERR_CONNECTIO_RESET from any explorer.
What i've tried:
The dll is located in the right place, the bin folder. I tried moving
it to system32 and other locations. However if I change the name of
the dll on the DLLIMPORT call i do get an error of not locating the
dll, which means it does finds the dll, just crashes on the method.
I also used GetLastWin32Error() and got the message 127
ERROR_PROC_NOT_FOUND. Not sure if it's relevant, however is something
I tried too.
If I run the Webservice on debug from VisualStudio, I get no error on
the call. So the error is when running on IIS.
I also tried on a older machine with IIS 6 on Windows XP and I get no
error. This make me think it has to do with a security issue, because
when I created the website on IIS I got this screen:
IIS 6
And i haven't configurated any security options on IIS 7.5. So i tried this
http://forums.iis.net/post/2119656.aspx
Which are steps to configure the user with enough permissions over the folder. However, still no luck.
What i believe now could be, is something asociated to GOP (Group Policy Object). The pc I'm running this service is on a company network. I have admin rights and no firewall restrictions, however I don't know if IIS 7.5 uses something from a different user or needs different permissions.
All the other threads i've found don't have the right answer for me. Any help i could get is appreciated.
Finally after a week of dealing with this, I found the problem. After finding out there are some Logs I could check on C:\Windows\System32\LogFiles\HTTPERR i found the error code Connection_Abandoned_By_ReqQueue.
After some long investigation, I found out that the message means the program is droping because of memorry corruption (As seen on this post Connection_Abandoned_By_ReqQueue Problems ). The dll I'm using is quite old and the people who generated didn't make a version who handles memory the correct way (At least for IIS 7.5), so I'm stuck with finding another library to do that work, or using a server with IIS 6.
In Brief
When I attempt to browse my website, I get the following error message:
CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\www\xxx\yyy\zzz\a.b.dll' - 'The directory name is invalid'
In Detail
I have two web-sites on my Development PC (fictitious names):
Web2 - this is written in ASP.NET using .NET 3.5 and runs in an AppPool that addresses the v2.0 .NET framework and runs in an Integrated mode. This is developed using Visual Studio 2010
Web4 - this is written in ASP.NET using .NET 4.5 and runs in an AppPool that addresses the v4.0 .NET framework and runs in an Integrated mode. This is developed using Visual Studio 2012.
Recently, I've been working in VS2012 on Web4 almost constantly and it works fine, however the other day I tried to run Web2 and got the exception displayed above.
Bizarrely, part of the path (which I replaced above with letters "zzz") appear to point to a German language path, since it's "\de-DE\" - I'm not operating in German, so I've no idea where it got this idea from.
One thing that is almost certainly un-related, but for some unknown reason I feel it's important to mention: I was using the Performance Analysis tool in Visual Studio 2012 the day before this problem first appeared and I don't know if this might have made some changes to my computer...??
Attempted fixes
There are quite a few threads regarding this on the internet; some threads end in success where file access permissions have been altered whilst others finish on a somewhat desperate sounding note... I have gone through the process of comparing the NTFS permissions on all relevant sounding directories on my PC with that of a colleagues on whose machine this is still working. Unfortunately, no joy to be had there.
I have also un-installed asp.net 2.0 and re-installed it using:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -u
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -ir
and again, no joy to be had there either.
My Web4 continues to run unaffected.
Also FYI: using IIS 7.5 on Win7 x64.
I'm now turning to the this wider audience in the hope of turning my current state of despair into one of success.
Thanks everyone
Griff
In IIS Manager, in the advanced settings of the Application Pool, make sure "Process Model > Load User Profile" is set to "True".
I had this exact same problem. I tried changing permissions, disabling anti-virus, creating a new app pool, and reinstalling .NET. I even created a new site with just a "Default.aspx" page and tried to view that site. Even that site had the compilation error. Finally, I noticed that my app pools (clean test site and main site) had the non-default value "False" for the Load User Profile setting. I set that back to true and the issue went away.
The answer was found using ProcMon:
http://technet.microsoft.com/en-us/sysinternals/bb896645
The temporary asp.net files are first created in the user's temp folder and then moved into this folder. For some as yet unknown reason, the compilation for my Web2 site (.NET 2 AppPool) now uses the same folders as my Web4 (.NET 4 AppPool) site.
I used ProcMon to identify all results for "access denied" and gave the IIS_IUSRS group write permissions (and in one case - C:\Users\ASP.NET V4.0 Integrated - modify permissions).
I have no idea why the compilation is using the "wrong" folders and I suspect I may have over-elevated the permissions in some cases, but for now it's working.
In case the above answers didn't fix it for you, check your environment variables (right-click on Computer -> Properties -> Advanced System Settings -> Advanced tab -> Environment Variables
Make sure the temp variables are pointing to a folder with all the necessary permissions. (full access for Network Service, IIS_IUSRS)
Note: don't check just the two variables at the top, look inside the scroll menu under System Variables. You might find the variables configured there too.
It may not be the cause, but this error started occurring for me after trying to run VS 2010 Performance Wizard with the Instrumentation method.
A quick fix in my DEV environment: changed the Identity of the Application Pool of the app to LocalSystem.
I'm having a bit of a problem running an AWS Console Application created in VS2010, on the cloud, on the EC2.
When ran on my desktop, it poses no problems, but, when moved to the cloud, it thrown an error saying that it cannot find the AWSSDK.dll.
I changed the path of the references, so that it would mimic the folder structure on the cloud, but that didn't work.
I tried to put another copy of the dll in the application folder and hoped for a miracle, but that didn't work either.
The last thing I tried was to load the dll manually with the AssemblyResolve, but that didn't work either.
Thanks, Catalin
you may visit here
http://aws.amazon.com/sdkfornet/
stick with the style of the code sample
i was tried previously and success =D