Click here to Skip to main content
15,896,321 members
Please Sign up or sign in to vote.
2.00/5 (4 votes)
See more:
I have a console application developed for a specific purpose. How to use this application by Web services?
Posted
Comments
I.explore.code 1-Oct-12 9:12am    
why do you need to use a console application from a web-service? is anyone ever gonna see the console?
Stephen Hewison 1-Oct-12 9:52am    
Perhaps it's just a command line utility? Don't know why you've voted this down? I quite happily allow a web services to execute console applications. I've got an old FoxPro utility which is launched via a web service call.
I.explore.code 1-Oct-12 9:59am    
I didn't vote it down. Just asked an honest question. :)
Stephen Hewison 1-Oct-12 10:01am    
Then I apologise. I thought it was a legitimate question. But then that's just me. :-)
I.explore.code 1-Oct-12 10:51am    
no worries!

You can launch any command line application or in fact any application from C# by starting a new Process

C#
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:

C#
while(!notePad.HasExited) { System.Threading.Thread.Sleep(100); } 


Then pick up your response and return the service call result.
 
Share this answer
 
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900