I have a collection of sites running on a single server. The server also runs a console application which collects data and distributes this data to the websites.
I am not always about to check if the application is running and I would like to give the end user (a select few users!) the option to start/restart this application on the server by using a webform. (click a button and application starts).
I have got the console application to start by using the following code:
ProcessStartInfo info = new ProcessStartInfo(FileName);
Process App1 = null;
App1 = Process.Start(info);
But no console window appears and I would like the console to open a window s开发者_运维知识库o that if I log onto the server I can check that the application is running.
I have tried adding:
info.CreateNoWindow = false;
and a few other things, but this is not my area so I am struggling.
Any ideas how I can get the console to open in a normal window? Or am I going about this all the wrong way?
Also, is there a way of finding if the application is running and either kill it before trying to start it, just restarting it, or not allowing the end user the option to do anything.
Many thanks T
As Aristos says, the console app will open on the server...not the client.
Look here for a start on how to open a process from asp and the security implications
If you need the client to be able to view anything I suggest having the service write to a log in a database and having the aspx page read this log.
Also, maybe write your console app as a windows service, not just an application?
Good example here
Hope this helps.
ProcessStartInfo info = new ProcessStartInfo(FileName);
Process App1 = null;
info.CreateNoWindow = true;
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
App1 = Process.Start(info);
try using info.usershellexecute property
精彩评论