Executing a program

Discussion in 'ASP .Net' started by tshad, Oct 13, 2009.

  1. tshad

    tshad Guest

    I am trying to execute a program from my web page on a 2003 server.

    Both the program and the web application are on the same server.

    The program normally runs as a scheduled task but we need to allow the
    inhouse users to be able to manually start the program which just reads a
    file and fills various tables with it.

    When I run it on my workstation, it works fine. We have a user defined to
    run the program and I am using impersonation to run the program.

    The problem is that it doesn't seem to execute on the server.

    Is there something special I need to set up this up?

    My code to execute the program is (with program containing the path and
    executable name):

    // Impersonate, automatically release the impersonation.

    using (new Impersonator("User", "server", "password"))
    {
    Process p = new Process();
    p.StartInfo.FileName = program;
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.CreateNoWindow = false;
    p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
    p.Start();
    }

    This runs on my laptop running IIS without any problem (without the
    impersonation).

    Thanks,

    Tom
     
    tshad, Oct 13, 2009
    #1
    1. Advertising

  2. tshad

    tshad Guest

    The errors I am getting in the event log are:



    Event Type: Error

    Event Source: .NET Runtime 2.0 Error Reporting

    Event Category: None

    Event ID: 5000

    Date: 10/13/2009

    Time: 3:29:24 PM

    User: N/A

    Computer: OBERON

    Description:

    EventType clr20r3, P1 autoups.executable.exe, P2 1.0.0.0, P3 4ad3e1e5, P4
    autoups.executable, P5 1.0.0.0, P6 4ad3e1e5, P7 1, P8 5f, P9
    system.typeinitialization, P10 NIL.



    Event Type: Error

    Event Source: VsJITDebugger

    Event Category: None

    Event ID: 4096

    Date: 10/13/2009

    Time: 3:29:29 PM

    User: NT AUTHORITY\NETWORK SERVICE

    Computer: OBERON

    Description:

    An unhandled exception ('System.TypeInitializationException') occurred in
    AutoUPS.Executable.exe [3692]. Just-In-Time debugging this exception failed
    with the following error: Debugger could not be started because no user is
    logged on.



    Thanks,



    Tom

    "tshad" <> wrote in message
    news:...
    >I am trying to execute a program from my web page on a 2003 server.
    >
    > Both the program and the web application are on the same server.
    >
    > The program normally runs as a scheduled task but we need to allow the
    > inhouse users to be able to manually start the program which just reads a
    > file and fills various tables with it.
    >
    > When I run it on my workstation, it works fine. We have a user defined to
    > run the program and I am using impersonation to run the program.
    >
    > The problem is that it doesn't seem to execute on the server.
    >
    > Is there something special I need to set up this up?
    >
    > My code to execute the program is (with program containing the path and
    > executable name):
    >
    > // Impersonate, automatically release the impersonation.
    >
    > using (new Impersonator("User", "server", "password"))
    > {
    > Process p = new Process();
    > p.StartInfo.FileName = program;
    > p.StartInfo.UseShellExecute = false;
    > p.StartInfo.CreateNoWindow = false;
    > p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
    > p.Start();
    > }
    >
    > This runs on my laptop running IIS without any problem (without the
    > impersonation).
    >
    > Thanks,
    >
    > Tom
    >
     
    tshad, Oct 14, 2009
    #2
    1. Advertising

  3. tshad

    Mr. Arnold Guest

    "tshad" <> wrote in message
    news:...
    >I am trying to execute a program from my web page on a 2003 server.
    >
    > Both the program and the web application are on the same server.
    >
    > The program normally runs as a scheduled task but we need to allow the
    > inhouse users to be able to manually start the program which just reads a
    > file and fills various tables with it.
    >
    > When I run it on my workstation, it works fine. We have a user defined to
    > run the program and I am using impersonation to run the program.
    >
    > The problem is that it doesn't seem to execute on the server.
    >
    > Is there something special I need to set up this up?


    I would suggest looking up how to make an ASP.NET UI call a Windows NT
    Service and have the code in the WS or make the WS execute the exe in
    question.


    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4504 (20091013) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com
     
    Mr. Arnold, Oct 14, 2009
    #3
  4. tshad

    bruce barker Guest

    while the thread starting a process needs enough permission to start
    one, the new process will not run as the thread impersonation account,
    but rather as the process owner account (probably system on your
    workstation, but locked down on the server).

    you probably need the program to do the impersonation, also the default
    dir will be system32, not the vdir.

    -- bruce (sqlwork.com)

    tshad wrote:
    > I am trying to execute a program from my web page on a 2003 server.
    >
    > Both the program and the web application are on the same server.
    >
    > The program normally runs as a scheduled task but we need to allow the
    > inhouse users to be able to manually start the program which just reads a
    > file and fills various tables with it.
    >
    > When I run it on my workstation, it works fine. We have a user defined to
    > run the program and I am using impersonation to run the program.
    >
    > The problem is that it doesn't seem to execute on the server.
    >
    > Is there something special I need to set up this up?
    >
    > My code to execute the program is (with program containing the path and
    > executable name):
    >
    > // Impersonate, automatically release the impersonation.
    >
    > using (new Impersonator("User", "server", "password"))
    > {
    > Process p = new Process();
    > p.StartInfo.FileName = program;
    > p.StartInfo.UseShellExecute = false;
    > p.StartInfo.CreateNoWindow = false;
    > p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
    > p.Start();
    > }
    >
    > This runs on my laptop running IIS without any problem (without the
    > impersonation).
    >
    > Thanks,
    >
    > Tom
    >
    >
     
    bruce barker, Oct 14, 2009
    #4
  5. tshad

    tshad Guest

    Actually, there is exception handling in it.

    It seems to happen when trying to start the program before it gets to my
    TRY.

    On the web side, it just starts the program and goes on and assumes it
    started fine.

    Tom

    "Mark Rae [MVP]" <> wrote in message
    news:%...
    > "tshad" <> wrote in message
    > news:...
    >
    >> Event Source: .NET Runtime 2.0 Error Reporting
    >> Event Source: VsJITDebugger

    >
    >> An unhandled exception ('System.TypeInitializationException') occurred in
    >> AutoUPS.Executable.exe [3692]. Just-In-Time debugging this exception
    >> failed with the following error: Debugger could not be started because no
    >> user is logged on.

    >
    > Pretty self-explanatory - "an exception has occurred but you don't have
    > any exception handling in your code so I can't tell you about it and
    > instead I'm going to try to launch the JIT Debugger so you can investigate
    > but unfortunately no user is logged for me to do this".
    >
    > Put some exception handling in your code, find the error, and then fix
    > it...
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
     
    tshad, Oct 14, 2009
    #5
  6. tshad

    tshad Guest

    "Mr. Arnold" <MR. > wrote in message
    news:...
    >
    > "tshad" <> wrote in message
    > news:...
    >>I am trying to execute a program from my web page on a 2003 server.
    >>
    >> Both the program and the web application are on the same server.
    >>
    >> The program normally runs as a scheduled task but we need to allow the
    >> inhouse users to be able to manually start the program which just reads a
    >> file and fills various tables with it.
    >>
    >> When I run it on my workstation, it works fine. We have a user defined
    >> to run the program and I am using impersonation to run the program.
    >>
    >> The problem is that it doesn't seem to execute on the server.
    >>
    >> Is there something special I need to set up this up?

    >
    > I would suggest looking up how to make an ASP.NET UI call a Windows NT
    > Service and have the code in the WS or make the WS execute the exe in
    > question.


    Actually, I will just have change the program to run as a WS and handle it
    from there.

    Thanks,

    Tom
    >
    >
    > __________ Information from ESET NOD32 Antivirus, version of virus
    > signature database 4504 (20091013) __________
    >
    > The message was checked by ESET NOD32 Antivirus.
    >
    > http://www.eset.com
    >
    >
    >
     
    tshad, Oct 14, 2009
    #6
  7. tshad

    tshad Guest

    "bruce barker" <> wrote in message
    news:...
    > while the thread starting a process needs enough permission to start one,
    > the new process will not run as the thread impersonation account, but
    > rather as the process owner account (probably system on your workstation,
    > but locked down on the server).
    >
    > you probably need the program to do the impersonation, also the default
    > dir will be system32, not the vdir.
    >

    Not sure how I would do that.

    I am not running as a thread. I thought that Process would start a new
    process to run by itself. How would you give the credentials to the process
    (.exe) that would allow it to run.

    We already set up a specific User with enough permissions to run. And it
    works fine on my desktop machine, just won't work on the Server.

    Thanks,

    Tom

    > -- bruce (sqlwork.com)
    >
    > tshad wrote:
    >> I am trying to execute a program from my web page on a 2003 server.
    >>
    >> Both the program and the web application are on the same server.
    >>
    >> The program normally runs as a scheduled task but we need to allow the
    >> inhouse users to be able to manually start the program which just reads a
    >> file and fills various tables with it.
    >>
    >> When I run it on my workstation, it works fine. We have a user defined
    >> to run the program and I am using impersonation to run the program.
    >>
    >> The problem is that it doesn't seem to execute on the server.
    >>
    >> Is there something special I need to set up this up?
    >>
    >> My code to execute the program is (with program containing the path and
    >> executable name):
    >>
    >> // Impersonate, automatically release the impersonation.
    >>
    >> using (new Impersonator("User", "server", "password"))
    >> {
    >> Process p = new Process();
    >> p.StartInfo.FileName = program;
    >> p.StartInfo.UseShellExecute = false;
    >> p.StartInfo.CreateNoWindow = false;
    >> p.StartInfo.WindowStyle =
    >> ProcessWindowStyle.Maximized;
    >> p.Start();
    >> }
    >>
    >> This runs on my laptop running IIS without any problem (without the
    >> impersonation).
    >>
    >> Thanks,
    >>
    >> Tom
     
    tshad, Oct 14, 2009
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cédric Rossé
    Replies:
    2
    Views:
    1,087
    Cédric Rossé
    Sep 29, 2004
  2. Ben Fairbank
    Replies:
    2
    Views:
    5,498
  3. Randy Kreuziger

    Executing a DOS program from within Python

    Randy Kreuziger, Mar 16, 2006, in forum: Python
    Replies:
    1
    Views:
    446
    iapain
    Mar 16, 2006
  4. Shadow123
    Replies:
    0
    Views:
    311
    Shadow123
    Aug 11, 2008
  5. manish sahu
    Replies:
    11
    Views:
    811
    Keith Thompson
    Feb 13, 2010
Loading...

Share This Page