2

I have an api running in IIS written in .net framework 4.7.1 that needs to start a console app, but when I call Process.Start(@"\\boxName\d$\moreFoldersHere\FileName.exe"), it hangs on execution, and the console app does not start. I have verified that the app pool under which the site is running has full perms to both the directory containing the exe and the exe itself, and I have made the service account an administrator on the box with no luck. I have no trouble running the app, but even when I set the app pool to run as myself, the behavior does not change.

Purely for context... the api needs to trigger a process that may take an unreasonable amount of time to complete. Obviously I don't want the api response waiting on it, so I don't want to wait for the result of the process; I just want to fire-and-forget. I also don't want iis cleanup killing it after some period of "no activity", and I need to potentially have multiple instances of this same process executing at the same time on the same box.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
R Stevens
  • 65
  • 6
  • @EJoshuaS-StandwithUkraine I don't think it does. The first link in your linked answer is dead (and besides, it isn't working when running as me (an admin on the box); I can log on to that box no problem), and I won't have permission to fiddle with iis settings; we'd setup the app to run on a schedule in TaskScheduler before we'd do that. – R Stevens May 09 '22 at 20:50

2 Answers2

1

I found the answer... In IIS, in the App pool, LoadUserProfile needs to be set to True.

I'm not sure why it defaulted to False, but everything is working fine now.

R Stevens
  • 65
  • 6
-1

Since it's a console app, your issue is likely the need to read the output. See this answer.

zeplar_exe
  • 90
  • 1
  • 12
  • Would that apply? I'm not saving the return of Process.Start, and not consuming the output of the process. – R Stevens May 09 '22 at 20:46
  • @RStevens From the comments, "There's only a 2k output buffer, it will hang when you don't empty it." Whether you take the return value or not shouldn't matter. – zeplar_exe May 09 '22 at 21:00
  • but it's not executing the exe at all, not just executing until the buffer fills; the first action of the app is to write to a log, and no logs are created when running process.start – R Stevens May 10 '22 at 13:50