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