How to launch a console application from an IIS based web service, and have it visible while processing?
I'm trying to launch a console app from an IIS based web service, but its not visible on the server.
Code so far is:
string downloaderPath = ConfigurationManager.AppSettings["DownloaderExePath"];
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo();
si.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
si.FileName = downloaderPath;
si.UseShellExecute = true; //false doesn't make a difference
System.Diagnosti开发者_StackOverflow中文版cs.Process.Start(si);
The process fires, but with errors. Would like to have it visible on the screen, is this possible?
I don't think there is anything in the .Net BCL that would allow you to do so, even if it is at all possible.
You would need to start the application in the current 'interactive' user session. When starting the app from the webservice, it is running in the session of IIS (as a service).
Perhaps looking at tools like psexec might shed some light on how to get this working.
Alternatively, log the errors to a file and/or attempt to hook up a debugger to the iis process (w3wp.exe)
精彩评论