Catch and report errors from external app called using new Process

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg Allan

    Catch and report errors from external app called using new Process

    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.Fil eName = "rs.exe";
    p.StartInfo.Arg uments = "";//"rs -i PublishReports. rss -s
    http://localhost/reportserver";
    try
    {
    p.Start();
    }
    catch(Exception ex) {MessageBox.Sho w(ex.Message);}

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

    Thanks in advance,

    Greg Allan
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Catch and report errors from external app called using new Process

    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.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Greg Allan" <GregAllan@disc ussions.microso ft.com> wrote in message
    news:E70F574E-5E28-44FD-84AA-483BF778C6EE@mi crosoft.com...[color=blue]
    > 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.Fil eName = "rs.exe";
    > p.StartInfo.Arg uments = "";//"rs -i PublishReports. rss -s
    > http://localhost/reportserver";
    > try
    > {
    > p.Start();
    > }
    > catch(Exception ex) {MessageBox.Sho w(ex.Message);}
    >
    > My post in Reporting Services did not get any responses so I thought I'd
    > try
    > here.
    >
    > Thanks in advance,
    >
    > Greg Allan[/color]


    Comment

    Working...