Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Webservice to call a batch file?

Reply
Thread Tools

Webservice to call a batch file?

 
 
Lee Franke
Guest
Posts: n/a
 
      12-11-2006
I've written a small webservice that all it does is call a batch file on the
server passing along some parameters.

It seems that the batch file (sm.cmd) exits after only executing for a
second or two.

Here is the code

private string CallExecutable(string Path, string Arguments)
{
string sReturn = "";
try
{
Process proc = new Process();
if(File.Exists(Path))
{
//proc.StartInfo = new
ProcessStartInfo(ConfigurationSettings.AppSettings["ExecutablePath"].ToString(),
"buildspecs." + sBuildSpec);
proc.StartInfo.FileName = Path;
proc.StartInfo.Arguments = Arguments;
//proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.UseShellExecute = true;
//proc.Exited += new EventHandler(OnExited);
//proc.EnableRaisingEvents = true;

bool bTest = proc.Start();
proc.WaitForExit(9000);
proc.Dispose();
sReturn = bTest.ToString();
}
else
sReturn = "Executable does not exist";

}
catch(Exception ex)
{
sReturn = ex.Message;
}
return sReturn;


}




I've tried increasing the time on teh WaitForExit, I've also tried leaving
it blank so that it waits until completetion.

The reason I know it exits after briefly executing is that a log is written
by sm.cmd and it only shows a small bit of processing.

Any ideas on how to fix this?



thanks,

lee


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Asynchronous Call of WebService method within a WebService René Preußler ASP .Net Web Services 0 10-29-2008 11:55 AM
Problem to call a WEBSERVICE in another WEBSERVICE (AXIS/ TOMCAT) Cyril Java 2 06-01-2006 06:07 PM
Problem! webservice.htc calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 1 01-26-2006 12:05 PM
how to call webmethods in a batch ranga ASP .Net Web Services 1 01-05-2005 03:15 AM
how to make webservice calls in a batch ranga ASP .Net Web Services 2 01-04-2005 12:13 AM



Advertisments