从控制台应用程序获取响应(Windows中的命令提示符)

时间:2015-08-24 12:17:31

标签: c# web-services rest console-application

我有Web UI,Client_Console,Loader_Console。

请考虑以下两种情况

场景1: Client_Console将调用WebService(REST),通过只有我传递输入它将调用其他控制台应用程序(loader_console),这很好,我能够从loader_console获得响应并成功显示在Client_console中。

场景2: 从Web UI我需要将Inputs传递给Client_console,它将调用webservice并将输入传递给Loader_console。

现在我的问题是,当所有操作完成后,我无法从Client_Console获得响应。

下面我包含我的代码的一部分

        Process InvokeTool = new Process();
        InvokeTool.StartInfo.FileName = toolToInvoke;


        InvokeTool.StartInfo.RedirectStandardInput = true;

        InvokeTool.StartInfo.CreateNoWindow = true;
        InvokeTool.StartInfo.RedirectStandardOutput = true;
        InvokeTool.StartInfo.UseShellExecute = false;

        try
        {
            InvokeTool.Start();
        }
        catch (Exception ex)
        {
            var exceptn = ex.ToString();
            lbl_Response.Text = "ERROR : Could not find the tool specified in the client json config file";
            return;
        }

        StreamWriter writer = InvokeTool.StandardInput;


        writer.WriteLine(sourcefolderURL);
        writer.WriteLine(jsonFileLocation);
        writer.WriteLine(fieldSeperator);
        writer.WriteLine("NO");

        StreamReader reader = InvokeTool.StandardOutput;
        //InvokeTool.Kill();
        //InvokeTool.CloseMainWindow();

        var result = reader.ReadToEnd();
        string[] responseArray = result.Split(':');

请帮我解决这个问题

0 个答案:

没有答案