0

net application. I want to show a output from a other exe program. I test my Program on the development pc and it works but if I install the application on the windows server 2008 r2 (IIS7) then I don't get a output. I get nothing :(

I try to add the path to this exe hardcode but this work only on the development pc.

Here is my C# Code:

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    string path = @"C:\\Windows\\TEMP\\lstc_qrun.exe -s lwserv-lic -R";

                    Response.Write(path);

                    string o = class.ExecuteCommand(path);

                    txtoutput.Text = o;

                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }

            }
        }

string path is the path to this exe and the command that I use to get output. On the WinServer08R2 is the temp path in C:\windows ... I put the exe in the temp folder.

the path is on the server correct. If I test the exe on a terminal than I get the output!

Here is my ExecuteCommand Method:

public static string ExecuteCommand(string command)
        {
            int exitCode;
            ProcessStartInfo processInfo;
            Process process;

            try
            {
                processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
                processInfo.CreateNoWindow = true;
                processInfo.UseShellExecute = false;
                processInfo.RedirectStandardError = true;
                processInfo.RedirectStandardOutput = true;


                using (process = Process.Start(processInfo))
                {
                    string output = process.StandardOutput.ReadToEnd();
                    exitCode = process.ExitCode;

                    return output;
                }

            }
            catch (Exception ex)
            {
                return "error: " + ex.Message;
            }

        }

I don't understand what is diffrend to the development machine :-( ?

The path is correct! The Exe work on the server, if I test it with terminal! I don't get a output... and no error!

help me

Tarasov
  • 3,625
  • 19
  • 68
  • 128
  • Do you get any exceptions ? – Perfect28 Jun 23 '14 at 08:17
  • asp.net account have very limited permissions for security reasons. You can't access that exe until asp account has proper permissions, access, and trust to run the requested program. – Ricky Jun 23 '14 at 08:19
  • Anyway, what are you trying to accomplish by running that exe on server with an asp page? – Ricky Jun 23 '14 at 08:21
  • with other exe's it works ...I get zhe output...but this exe what i try to execute want to create a inf file and than I got a message that the inf file couldn't create...so I try it to do on the temp folder for testing but now I get nothing :D :( – Tarasov Jun 23 '14 at 08:25
  • Yes I do it with a ASP.NET Form – Tarasov Jun 23 '14 at 08:26

0 Answers0