简体   繁体   中英

How to get server-side console app to run on ASP.net website(IIS7)?

I have an ASP.net website that is hosted on IIS7, within the asp.net code I have a C# statement that launches a .exe on my webserver on a button click. For some reason in visual studio it will launch on the local development server but when I move it to the IIS7 server it will not pop up a black console box on button click. This is what I am doing.

generateSpanish = "/n= " + serverName + "GenerateVoice SpanishVoice";

Process serverSideCommandSpanish = new Process();

serverSideCommandSpanish.StartInfo.FileName = Server.MapPath("Config\myexe.exe");
serverSideCommandSpanish.StartInfo.Arguments = generateSpanish;
serverSideCommandSpanish.EnableRaisingEvents = true;
serverSideCommandSpanish.StartInfo.UseShellExecute = true;

serverSideCommandSpanish.Start();

Again it launches in visual studio( a black console app pops up on the "server") but on my IIS server it does not do the console app popup serverside?

You need to enable the handler for exe's under IIS7. Do this by going to the web site under MMC and select Handler Mappings.

You may be able to get this to work using telling your Process to run PsExec with the -i argument and having PsExec run the .exe you're actually trying to start. The -i argument tells PsExec to execute the target in interactive mode on the desktop of a specified user session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM