Find Me Find Me - 1 year ago 117
ASP.NET (C#) Question

IIS7 does not start my Exe file by Process Start but it's running in task bar

I have created a project with process start in c# it's running in local visual studio build,when I hosting it in IIS it's not running but it's starting the processes and nothing is displaying I checked it in task manager.Code sample:

`Process process = new Process();`
`process.StartInfo.FileName = "calc.exe";`
`process.StartInfo.UseShellExecute = false;`

And I have tried following solutions

IIS7 does not start my Exe file by Process Start

Foo.cmd won't output lines in process

System.Diagnostics.Process.Start not work from an IIS

nothing helped.If any one knows please help me

Answer Source

I have searched a lot and finally I find a solution,It my be helpful to some one.

Solution : with IIS runs as a service application, which means that it runs under another Window Station and Desktop. However, in Windows, the default visible Window Station and Desktop is WinSta0\Default, which is where the Shell(explorer.exe) runs. So the .exe you created is displayed in an invisible desktop.

Actually, Window Station and Desktop is a good sandbox for GUI security, since Windows do not want the normal GUI application to communication other Services applications through Windows Message.

To display the GUI from a non-visible service application, you have to break the security sandbox of WinSta0\Default, which is a little complex.

However, if you want to create a visible process, it is really hard. Normally, the recommended solution is creating a second GUI application like Winform, and the and Winform can communicates through .Net Remoting or other Inter process communication technologies. When the wanted to create the visible notepad process, it can tell the Winform client through Net Remoting, then Winform will simply Proces.Start notepad.exe on behalf of process.

.Net Remoting is the solution to solve this problem (refer this link .NET Remoting with an easy example )

Download sample from Click Here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download