0

I'm trying to start a c# program from a wep api. When i try this under Visual studio develop it runs. After pubishing it on IIS the program does not start. I dont't get any errors, it never runs in the catch block. Why doesn't the "process.Start" work?

public class ServerController : ApiController
{

    [ActionName("starthilfe")]
    public Info GetHelp()
    {
        Info inf = new Info();
        try
        {
            Process P = new Process();
            P.StartInfo.FileName = @"D:\Videos\Deutsch\WindowsFormsApp1.exe";
            P.Start();
            inf.TextFeld1 = "Hilfe erfolgreich gestartet";
            return inf;
        }
        catch (Exception ex)
        {
            inf.TextFeld1 = "EXEPTION";
            inf.TextFeld2 = ex.Message;
            return inf;
        }
    }
}

1 Answers1

0

First I would check to see what permission issues you run into on your server running the application. Second I think that the core of your issue is that when you are running a web app in debug mode you are running as you. But when you publish to IIS your most likely running as IUser. The special user for IIs websites. This stack overflow article could help you figure out what rights your IUser has. a workaround for this is to create another user for the application that has more rights than IUser. Just a reminder changing the user that your web app uses could have security implications. So you should be careful

Paul Hebert
  • 223
  • 2
  • 7
  • I set all permissions for the folder that contains the programm to full accsess for everyone. – smalldevice Dec 13 '18 at 14:59
  • Since it's not a permission problem than it has to do with the nature of your win forms app. Does the app run on the server when you are not calling it from a website, this might mean that you are missing a DLL or a config file. Does your app prompt for input, because the IIS will not pop up the window for you to see it? Remember it is logged in as the IIS User, The IIS user doesn't have a desktop. – Paul Hebert Dec 13 '18 at 19:54
  • Thanks for your help, but now I'm tired of working on that Item. I will implement my help system on frontend side. Would have been nice to use the old c# programm because it is nearly perfekt for us. – smalldevice Dec 14 '18 at 07:37