Catch and report errors from external app called using new Process

G

Guest

Hello, I'm creating a little app in C# to help with deploying reports using
rs.exe from the SQL Reporting Services.
I create a new Process() with a Try and Catch but I would like to get the
errors returned by rs.exe as well as the new process I create in C#.

If I run this and intentionally leave out any parameters for rs.exe, the
whole process runs in a blink of an eye with no warnings or errors but of
course nothing has been deployed.
My code:
p = new Process();
p.StartInfo.FileName = "rs.exe";
p.StartInfo.Arguments = "";//"rs -i PublishReports.rss -s
http://localhost/reportserver";
try
{
p.Start();
}
catch(Exception ex) {MessageBox.Show(ex.Message);}

My post in Reporting Services did not get any responses so I thought I'd try
here.

Thanks in advance,

Greg Allan
 
N

Nicholas Paldino [.NET/C# MVP]

Greg,

The only way you will be able to get errors is through something like
automation or remoting. If you just use process, the only thing that you
have available to you is the return value on the executable itself. If that
is all you need to determine the error, then use that, otherwise, you will
have to see what hooks this program exposes, and connect to it that way (COM
automation, remoting, etc, etc).

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top