如何通过Web服务使用现有的控制台应用程序? [英] How to use an existing console application by Web services?
本文介绍了如何通过Web服务使用现有的控制台应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个为特定目的而开发的控制台应用程序.
解决方案
您可以通过启动新的Process
Process notePad = 新 Process(); notePad.StartInfo.FileName = " ; notePad.StartInfo.Arguments = " ; notePad.Start();
如果您需要暂停服务电话以进行响应,则:
while (!notePad.HasExited){System.Threading.Thread.Sleep( 100 ); }
然后获取您的响应并返回服务调用结果.
要使用控制台应用程序,它必须位于Web服务可访问的服务器中,或者通过远程执行或通过流程直接执行. /blockquote>
I have a console application developed for a specific purpose. How to use this application by Web services?
解决方案You can launch any command line application or in fact any application from C# by starting a newProcess
Process notePad = new Process(); notePad.StartInfo.FileName = "notepad.exe"; notePad.StartInfo.Arguments = "ProcessStart.cs"; notePad.Start();
If you need to hold up the service call for a response then:
while(!notePad.HasExited) { System.Threading.Thread.Sleep(100); }
Then pick up your response and return the service call result.
In order to use the console application, it would have to be sitting in a server accessible by the web service, either via remote execution or direct execution via Process.
这篇关于如何通过Web服务使用现有的控制台应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文