I need to start an exe on a click, so I have written below code and it is working when I run it with visual studio. However when we publish the app it fails to work on client.
public ActionResult ShowModuleApp(string modulePath)
{
var returnUrl = Request.UrlReferrer;
try
{
Process process = Process.Start(Request.PhysicalApplicationPath + @"Uploads\" + modulePath);
int exeId = process.Id;
Process tempProc = Process.GetProcessById(exeId);
process.EnableRaisingEvents = true;
GeneralFunctions.AddTraceLog(Convert.ToString(exeId));
}
catch (Exception ex)
{
GeneralFunctions.AddTraceLog(ex.Message);
return Redirect(returnUrl.AbsoluteUri);
}
return Redirect(returnUrl.AbsoluteUri);
}
I have also followed the below instructions.
To configure this, follow this steps. a. Open Control Panel and follow these steps: For Windows NT: click Services. For Windows 2000, Windows XP, and .NET Server: click Administrative Tools, and then click Services.
b. Double-click IIS Admin Service.
c. On the Log On tab, select the Allow Service to Interact with Desktop check box. Remember to run IIS Admin Service as a local system.
d. Stop and restart the IIS Admin Service.
But its not working either, I can see the Process Id logged in trace logs. Is it running in the background and not coming in front as I can see no exception traced.