简体   繁体   English

托管后,System.diagnostics.process进程无法在IIS上运行吗?

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

I am trying to install .exe from web application. 我正在尝试从Web应用程序安装.exe。 when i run the application locally(from asp development server) it is installing properly. 当我在本地运行应用程序(从ASP开发服务器)时,它安装正确。 But when i hosted on IIS it is not working. 但是当我在IIS上托管时,它无法正常工作。

I had written this code on Page_load method in asp.net page 我已经在asp.net页面的Page_load方法上编写了此代码

//Want to install Test.msi on client machine. //要在客户端计算机上安装Test.msi。

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 当我在本地运行应用程序(从ASP开发服务器)时,它安装正确

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. 如果您在受控环境中运行此站点,那么也许可以让系统管理员为您域中的某些用户组部署此安装程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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