i am trying to execute a r script from asp.net page using c# but it's not executing -
i have used rscript runner not working.
public static string setuppath(string rversion = "r-3.2.3") { var oldpath = system.environment.getenvironmentvariable("path"); var rpath = system.environment.is64bitprocess ? string.format(@"c:\program files\r\r-3.2.3\bin\x64", rversion) : string.format(@"c:\program files\r\r-3.2.3\bin\i386", rversion); if (!directory.exists(rpath)) throw new directorynotfoundexception( string.format(" r.dll not found in : {0}", rpath)); var newpath = string.format("{0}{1}{2}", rpath, system.io.path.pathseparator, oldpath); system.environment.setenvironmentvariable("path", newpath); return newpath.tostring() ; }
this button1_click method calls rscript runner.
protected void button1_click(object sender, eventargs e) { string s = setuppath(); string args = ""; string r = @"d:\scr1.r"; var rcodefilepath = string.format(@"d:\scr1.r", "r-3.2.3"); //string c = rscriptrunner.runfromcmd(rcodefilepath, s); string c = rscriptrunner.runfromcmd(r, "rscript.exe"); label1.text = c; }
got solution..!
i used "shiny" library in r. converts r script app can called asp.net using simple http request.
Comments
Post a Comment