[Mono-aspnet-list] Execute Shell commands from Mono .NET Web Service

peruukki peruukki4ever at gmail.com
Thu Jul 30 05:59:47 EDT 2009

Hi, I'm trying to execute shell commands from a web method in a web service
hosted with mono.
Command is executed but it would be nice to have the output of the command
returned to the caller.

If I host the same asmx but with xsp I receive the output.

What's the difference between the two "hosting" methods? 
Is there a best practice to execute shell command and have the "console"
output returned?


<%@ WebService Language="C#" Class="TestService.TestService" %>

using System;
using System.Web.Services;
using System.Diagnostics;

namespace TestService
        [WebService (Namespace = "http://tempuri.org/TestService")]
        public class TestService: WebService
                public string ExecuteCommand(int fakeNumber1)
                        ProcessStartInfo startinfo = new
ProcessStartInfo("xm" , "list");
                        startinfo.RedirectStandardOutput = true;
                        startinfo.UseShellExecute = false;
                        Process pro = null;
                                pro = Process.Start(startinfo);
                        catch(Exception ex){
                                return ex.Message;
                        string result = pro.StandardOutput.ReadToEnd();
                        return result;

View this message in context: http://www.nabble.com/Execute-Shell-commands-from-Mono-.NET-Web-Service-tp24735495p24735495.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.

More information about the Mono-aspnet-list mailing list