public string Upload(string remote, string local) { var cfg = CFService.Config(); Process process = null; string args = string.Format("-m p -a {0} -p {1} -r {2} -l {3}", MasterAddr, MasterPort, remote, local); var log = System.Web.HttpRuntime.AppDomainAppPath + "Exe/log.log"; System.IO.File.WriteAllText(log, args); var fileName = System.Web.HttpRuntime.AppDomainAppPath + "Exe/meloton"; process = new Process(); process.StartInfo.FileName = fileName; process.StartInfo.Arguments = args; process.StartInfo.UseShellExecute = false; // 是否使用外壳程序 process.StartInfo.CreateNoWindow = true; //是否在新窗口中启动该进程的值 process.StartInfo.RedirectStandardOutput = true; process.Start(); process.WaitForExit(); return(process.StandardOutput.ReadToEnd()); }
public ActionResult index(FormCollection formdata) { CFService service = new CFService(); service.MaratonAddress = formdata["MaratonAddress"]; service.MaratonPort = int.Parse(formdata["MaratonPort"]); service.MelotonAddress = formdata["MelotonAddress"]; service.MelotonPort = int.Parse(formdata["MelotonPort"]); service.Save(); return(RedirectToAction("index")); }
// GET: service public ActionResult index() { return(View(CFService.Config())); }