This project is read-only.

Pull R process out of IIS process

Mar 20, 2015 at 2:15 PM
Edited Mar 20, 2015 at 2:29 PM
I have a web application where I use R script and R.NET to create statistical plot based on data from database. Everything works like a charm until when R script produces an error, e.g. library not found, then the whole IIS process is down. I have to restart the IIS process to make my application running again.

I wonder if it is possible for c# to catch the error from R. Thus even an error occurs, rest of my application is still running. I have read some old post stating it is possible to pull R process out of IIS process using WCF for IPC, but I could not figure how. I was wondering if the R.NET experts could provide me some sample how it is done? I hope this is still within the scope of R.NET. Many many thanks!
Mar 23, 2015 at 7:02 AM
I'm about to embark on your path--webapi on iis. As a workaround to your desired approach, have you tried to catch the error in R with tryCatch function?
Mar 23, 2015 at 9:33 AM
Edited Mar 23, 2015 at 2:31 PM
subsci wrote:
I'm about to embark on your path--webapi on iis. As a workaround to your desired approach, have you tried to catch the error in R with tryCatch function?
Thank you very much for your answer! It's good to hear that someone else is also interested in this matter. :-)

I have tried "try catch", but strangely not every error can be caught. E.g. R error variable cannot be null can be caught, but library cannot be found cannot be caught. Instead the whole IIS process went down, have to restart the entire web server to make it work again, which can be truly catastrophic.

CORRECTION: I installed the latest version of R (3.1.3), C# seems to be able to catch the "library cannot be loaded" error now. I will try different things now to see if C# is able to catch them all.