ASP.NET Core 中调用 第三方应用


public class ValuesController : ControllerBase
    // GET api/values/123
    public ActionResult<string> Get(int id)
        using (var process = new Process())
            process.StartInfo.FileName = @"..\HelloWorld\bin\Debug\helloworld.exe"; // relative path. absolute path works too.
            process.StartInfo.Arguments = $"{id}";
            //process.StartInfo.FileName = @"cmd.exe";
            //process.StartInfo.Arguments = @"/c dir";      // print the current working directory information
            process.StartInfo.CreateNoWindow = true;
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError = true;

            process.OutputDataReceived += (sender, data) => Console.WriteLine(data.Data);
            process.ErrorDataReceived += (sender, data) => Console.WriteLine(data.Data);
            var exited = process.WaitForExit(1000 * 10);     // (optional) wait up to 10 seconds
            Console.WriteLine($"exit {exited}");
        return "value";


  1. Pingback: amoxicillin online
  2. viagra generic说道:

    I intended to create you a bit of note just to give thanks again for all the exceptional guidelines you've discussed at this time. It's incredibly generous of people like you in giving extensively all that a lot of folks could have distributed as an e-book in order to make some bucks for their own end, chiefly considering that you could have done it if you considered necessary. The creative ideas additionally acted as the easy way to be certain that most people have a similar dream just like mine to find out a little more in regard to this condition. I'm certain there are lots of more enjoyable moments ahead for folks who examine your blog.

  3. I enjoy you because of all of the effort on this blog. Betty delights in carrying out internet research and it's easy to see why. A lot of people hear all about the compelling form you convey advantageous guidance by means of the blog and attract contribution from other individuals about this area and my child has always been becoming educated a great deal. Enjoy the remaining portion of the new year. You're carrying out a brilliant job.


邮箱地址不会被公开。 必填项已用*标注

You must enable javascript to see captcha here!