我是控制台应用程序的新手。我需要从 Web 应用程序向控制台应用程序传递两个命令行参数,并从控制台应用程序获取返回的结果。
我在这里尝试过
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim proc = New Process() With { _
.StartInfo = New ProcessStartInfo() With { _
.FileName = "C:\Users\Arun\Documents\visual studio 2012\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe", _
.Arguments = TextBox1.Text & " " & TextBox2.Text, _
.UseShellExecute = False, _
.RedirectStandardOutput = True, _
.CreateNoWindow = True _
} _
}
proc.Start()
proc.WaitForExit()
Response.Write(proc.ExitCode.ToString())
End Sub
我的控制台应用程序代码是
Public Function Main(sArgs As String()) As Integer
Return sArgs(0)
End Function
但我无法从控制台应用程序获取返回值。有什么问题有人帮忙吗?