public ActionResult TestScript() { //var id = DbUtil.Db.ScratchPadQuery(@"MemberStatusId = 10[Member] AND LastName = 'C*'"); var file = Server.MapPath("~/test.py"); var logFile = $"RunPythonScriptInBackground.{DateTime.Now:yyyyMMddHHmmss}"; string host = Util.Host; var background = true; if (background) { HostingEnvironment.QueueBackgroundWorkItem(ct => { var pe = new PythonModel(host); //pe.DictionaryAdd("OrgId", "89658"); pe.DictionaryAdd("LogFile", logFile); PythonModel.ExecutePythonFile(file, pe); }); return(View("RunPythonScriptProgress")); } else { var pe = new PythonModel(host); pe.DictionaryAdd("LogFile", logFile); ViewBag.Text = PythonModel.ExecutePythonFile(file, pe); return(View("Test")); } }