我有控制台应用程序和 Web 应用程序。我正在像这样从 Web 应用程序调用控制台的主程序
网络
public void RunconsoleApplication(string CanpaignId) {
// Get the file path of your Application (exe)
string filePath = @"E:/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.exe";
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(filePath, CanpaignId);
System.Diagnostics.Process p = System.Diagnostics.Process.Start(info);
p.Start();
}
安慰
Class program {
static void Main(string[] args) {
Console.WriteLine("start without arg");
if (args.Length > 0) {
Program p = new Program();
// This is another function in the class, not copied here
p.CreateCanpaign(Convert.ToInt64(args[0]));
Console.WriteLine("stop");
}
}
}
现在有人可以解释为什么这个函数'CreateCanpaign(a)'被调用了两次。我是控制台应用程序的新手。提前致谢。