locked
HELP! - System.Diagnostics.Process.Start Can't run exe (command-line) IIS6.0 Windows 2003 RRS feed

  • Question

  • User1959021347 posted

    I can't run exe file using the process.start()

    Im using this code to run exe file:

                        Dim startInfo As System.Diagnostics.ProcessStartInfo
                        Dim pStart As New System.Diagnostics.Process

                        startInfo = New System.Diagnostics.ProcessStartInfo("some.exe")
                        startInfo.Arguments =  "Some Args"
                        startInfo.UseShellExecute = True
                        startInfo.WindowStyle = Diagnostics.ProcessWindowStyle.Normal
                        startInfo.CreateNoWindow = False
                        pStart.Start(startInfo)

    Symptoms:
    This works fine with my XP machine with IIS5.1, but I cant make this work with Server 2003 and IIS 6.0.
    In Server 2003, the process shows in the task manager but it doesnt execute as I'm expecting.

    Here is my Win Server 2003 configuration:
    -Framework 3.5
    -processModel runs on "SYSTEM" username
    -impersonation is set to true with admin username
    -IIS admin service and related services have been set to interact with desktop
    -ASPNET,IWAM,IUSR are set to administrator access (just to try)
    -IIS6.0 is running in iis 5.1 isolation mode

    Is there anything I missed out?

     

    Thursday, May 8, 2008 1:22 PM

Answers

  • User1073881637 posted

    Couple things.

    1) Adding debugging code to your EXE to determine how far along it's running.  Trap for all errors so you can detect if something isn't executed.  Log to the event log or a text file.

    2) Try a different window style property. startInfo.WindowStyle  have it try to be hidden.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Monday, May 12, 2008 5:13 AM
  • User1073881637 posted

    I'm not aware of anything else off-hand.  Here is a couple articles I found searching.

    http://www.codinghorror.com/blog/archives/000133.html

    http://www.thescarms.com/dotnet/Process.aspx

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, May 14, 2008 1:14 AM
  • User-1943209008 posted

    try this:


    1. change local policies for APSNET user:
    in WinXP: run secpol.msc

    go to Local Policies->User Rights Assignment
    find "Deny log on locally" and remove ASPNET user from it.

    then find "Deny logon locally" and remove ASPNET user from it.


    2. Security for files.
    if your application needs also to work with files (open, save, etc) you have to change security settings for the folders to allow user ASPNET modify nedeed files.

    to do this:
    - In Explorer right button mouse click the folder and select "Properties"
    - In Security tab, add "ASPNET" in and give desired permissions (Read, Write, Execute, etc).

     

    read here:

    http://mxdev.blogspot.com/2008/09/asp-net-run-application-exe-from-aspnet.html

     

    hope it helps

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, September 2, 2008 5:09 PM
  • User1959021347 posted
    Finally! Thank for the help. I've done it and it works.

    try this:


    1. change local policies for APSNET user:
    in WinXP: run secpol.msc

    go to Local Policies->User Rights Assignment
    find "Deny log on locally" and remove ASPNET user from it.

    then find "Deny logon locally" and remove ASPNET user from it.


    2. Security for files.
    if your application needs also to work with files (open, save, etc) you have to change security settings for the folders to allow user ASPNET modify nedeed files.

    to do this:
    - In Explorer right button mouse click the folder and select "Properties"
    - In Security tab, add "ASPNET" in and give desired permissions (Read, Write, Execute, etc).

     

    read here:

    http://mxdev.blogspot.com/2008/09/asp-net-run-application-exe-from-aspnet.html

     

    hope it helps

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, September 3, 2008 7:37 AM

All replies

  • User1073881637 posted

    Couple things.

    1) Adding debugging code to your EXE to determine how far along it's running.  Trap for all errors so you can detect if something isn't executed.  Log to the event log or a text file.

    2) Try a different window style property. startInfo.WindowStyle  have it try to be hidden.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Monday, May 12, 2008 5:13 AM
  • User1959021347 posted

    Hi Steve,

    Thanks for your reply. I tried what you told me. No luck. Eventhough process.start starts() the EXE, it doesnt do anything. It just shows in the task manager, no trace of log or anything...

     The exe im trying to run is a command line mp3 converter (Total Converter X). It works perfectly in my XP pro machine. Can you suggest any alternatives that dont require process.start code?

     Regards,
    Aldrin

    Monday, May 12, 2008 5:07 PM
  • User1073881637 posted

    I'm not aware of anything else off-hand.  Here is a couple articles I found searching.

    http://www.codinghorror.com/blog/archives/000133.html

    http://www.thescarms.com/dotnet/Process.aspx

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, May 14, 2008 1:14 AM
  • User-1438457176 posted

    I'm having the exact same problem.....did you figure it out?

    Nuwanda

    Friday, May 16, 2008 8:29 AM
  • User1959021347 posted

    Hi Nuwanda,

    No, I haven't figured it out yet.

     Aldrin

    Friday, May 16, 2008 12:36 PM
  • User-1943209008 posted

    try this:


    1. change local policies for APSNET user:
    in WinXP: run secpol.msc

    go to Local Policies->User Rights Assignment
    find "Deny log on locally" and remove ASPNET user from it.

    then find "Deny logon locally" and remove ASPNET user from it.


    2. Security for files.
    if your application needs also to work with files (open, save, etc) you have to change security settings for the folders to allow user ASPNET modify nedeed files.

    to do this:
    - In Explorer right button mouse click the folder and select "Properties"
    - In Security tab, add "ASPNET" in and give desired permissions (Read, Write, Execute, etc).

     

    read here:

    http://mxdev.blogspot.com/2008/09/asp-net-run-application-exe-from-aspnet.html

     

    hope it helps

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, September 2, 2008 5:09 PM
  • User-823196590 posted

    As the OP was not asking how to do this in WinXP, the ASPNET account has no relevance for Windows 2003 IIS 6.  In this case it would be NETWORK SERVICE or IIS_WPG.

    Tuesday, September 2, 2008 7:23 PM
  • User-1943209008 posted

     no ASPNET user in Windows 2003?

    i don't think so

    try to run the application from ASP.NET and you will see it run in Processes List and here you see the user under which this application is running...

     

    anyway it is easy to check

     

    Tuesday, September 2, 2008 7:46 PM
  • User1959021347 posted
    Finally! Thank for the help. I've done it and it works.

    try this:


    1. change local policies for APSNET user:
    in WinXP: run secpol.msc

    go to Local Policies->User Rights Assignment
    find "Deny log on locally" and remove ASPNET user from it.

    then find "Deny logon locally" and remove ASPNET user from it.


    2. Security for files.
    if your application needs also to work with files (open, save, etc) you have to change security settings for the folders to allow user ASPNET modify nedeed files.

    to do this:
    - In Explorer right button mouse click the folder and select "Properties"
    - In Security tab, add "ASPNET" in and give desired permissions (Read, Write, Execute, etc).

     

    read here:

    http://mxdev.blogspot.com/2008/09/asp-net-run-application-exe-from-aspnet.html

     

    hope it helps

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, September 3, 2008 7:37 AM
  • User-2092889429 posted

    PL

    Monday, September 8, 2008 6:26 AM
  • User2020137617 posted
    Please help me.

    I added a macro to MS WinWord to print any DOC file to default printer that is a PDF writer. (mPrintDefault is macro name)

    Now I write a simple code in ASPX page, to convert a sample DOC file to PDF format. (Using  System.Diagnostics)

    The problem is that every time I run the page, winword.exe is called by Network Service account and is remained in task bar and nothing else!

    I can run below line in RUN command prompt with success:

    "c:\Program Files\Microsoft Office\OFFICE12\WINWORD.EXE" "C:\test\sample.doc" /mPrintDefault /q /n"

    But in ASPX page no success.

    Before this, I used some other components to do this conversion. (DOC2PDF).

    With local users like Administrator it was OK but within ASPX pages was unsuccessful. Every time, winword.exe was called by IUSER or NetworkService and remained in taskbar without success or result.

    How I can fix this problem?
    I changed all permissions for target directory to WRITE, but no success.

    Best Regards
    Ali

    OS is Windows 2003
    Code is:
    ====================
    Partial Class test_diag
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Dim psi As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo()

    psi.FileName = "c:\Program Files\Microsoft Office\OFFICE12\WINWORD.EXE"
    psi.Arguments = "C:\test\1.doc""/mPrintDefault /q /n"

    System.Diagnostics.Process.Start(psi)

    End Sub
    End Class
    Sunday, December 21, 2008 8:27 PM
  • User511787461 posted

    Please see this thread for a solution.

    Wednesday, July 15, 2009 6:59 PM
  • User-1260033899 posted
    It's not working for IIS 7.0 . any .exe is not loading in IIS publish.
    Wednesday, September 7, 2011 8:58 AM
  • User-1672167363 posted

    Hi, 

    This is very old thread and the last link is bad and  Anil Ruia IIS Team Engineer has left.

    There are Security Restrictions and Risks that need to be considered.

    If you understand the Security Risks and still need to run executables look at

    Technet Elevation Power Toys http://blogs.technet.com/b/elevationpowertoys/ for methods and suggestions.

    Martin

     

    Thursday, September 8, 2011 6:36 PM
  • User-2012285469 posted

     

    I have the below code in ASP.NET C# and it work fine in local system + production machine when i tested in Visual Studio via DEBUG MODE. but it doesn't work in IIS.

    ProcessStartInfo startInfo = new ProcessStartInfo();
                    startInfo
    .FileName = Server.MapPath(filePath);
                    startInfo
    .Verb = "print";
                    startInfo
    .Arguments = "Printer Name";
                   
    Process proc = new Process();
                    proc
    .StartInfo = startInfo;
                    proc
    .Start();

                    proc
    .WaitForExit(5000);
                   
    if (proc.HasExited == false)
                   
    {
                        proc
    .Kill();
                   
    }

    Things i tried.

    1. Control panel > Admin Services > Services > IIS Admin Service > Log on Tab > check to interact with desktop. Reset IIS Admin and IIS.
    2. Printer Properties > Security > Grand ASPNET, NETWORK SERVICE, EVERYONE to full access.
    3. Tried to set another printer as Default Printer. Reinstall / Add Printer.

    I tried all the above with no success

    i am using latest acrobat reader 9 and i can print the test page from printer itself and from acrobat software.

    i believe this problem is IIS security issue but still can't solve, Please Help! Thanks!

    Wednesday, February 22, 2012 2:15 AM