0

.NET Application and I want do execute a exe.

To this exe:

This exe file is a program to show licensed users.

I test it on my development vm with visual studio 2010 and it works but if i deploy it on the iis7 on my webserver it doens't work. The error is :

ERROR: Cannot create qrun.inf file

What is the problem? Why can't the application create the file?

Here is my code:

Web.Config:

...
<setting name="LSDYNA_CMD" serializeAs="String">
        <value>~\\exe\\lstc_qrun.exe -s lwserv-lic -R</value>
      </setting>
...

The exe is in my exe folder

Here I get the value:

string cmd = Properties.Settings.Default.LSDYNA_CMD;
cmd = Server.MapPath(cmd);

string output = ExecuteCommand(cmd);
...

Here is the 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 try it on the web server directly and I get the list (O.o) I opened a cmd and make the command inside this.

I need help I don't know how I can do this :(

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Tarasov
  • 3,625
  • 19
  • 68
  • 128

1 Answers1

0

set writing permitions on your folder like this: IIS AppPoolIdentity and file system write access permissions

Or

You may create new folder in your ASP.NET Project and put your exe file there.

Community
  • 1
  • 1
MikkaRin
  • 3,026
  • 19
  • 34