简体   繁体   中英

System.diagnostics.process process is not working on IIS after hosting?

I am trying to install .exe from web application. when i run the application locally(from asp development server) it is installing properly. But when i hosted on IIS it is not working.

I had written this code on Page_load method in asp.net page

//Want to install Test.msi on client machine.

string filepath = Server.MapPath("~/NewFolder1/Test.msi");//NewFolder1 is on server

ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('"+filepath+"')", true);
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
startInfo.FileName = "cmd.exe";
// startInfo.Arguments = "/K msiexec.exe /i \"" + @"D:\Datta\CrispDoxCompression.msi" + "\" /quite /qn";
startInfo.Arguments = "/K msiexec.exe /i \"" + filepath + "\" /qn";
startInfo.Verb = "runas";
process.StartInfo = startInfo;
process.Start();

when I run the application locally (from asp development server) it is installing properly

Of course, because then the server and the client are the same machine. You're starting a process on the server, which also happens to be the client, but in production, this isn't the case.

If you want users to install an application on their machine, then create a page on your site that shows them how to do so, including a link where they can download the installer.

You are not able to automatically install software from a website on a client's machine, let alone silently.

Sit down a minute and think about the implications if what you were asking for were actually possible. Barring browser (plugin) exploits, the days when that was possible are long gone.

If you are running this site in a controlled environment, then perhaps you can get your system administrators to deploy this installer for certain user groups on your domain.

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