托管后,System.diagnostics.process进程无法在IIS上运行? [英] System.diagnostics.process process is not working on IIS after hosting?

查看:129
本文介绍了托管后,System.diagnostics.process进程无法在IIS上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Web应用程序安装.exe。当我在本地运行应用程序(从asp开发服务器)它正在正确安装。但是当我在IIS上托管时它无法正常工作。



我尝试了什么:



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.

What I have tried:

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

               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();

推荐答案

使用常识,并告诉我这个文件在哪里?

Use the common sense, and tell me where is this file?
string filepath = Server.MapPath("~/NewFolder1/Test.msi");



可以在本地访问吗?不会。它存在于服务器和代码上, Process.Start()也将在服务器上执行。在这种情况下,客户端几乎不会触发,并且服务器端的任何操作都不会告诉他任何内容,正如解决方案1中所述,管理员也不会让您在他们的计算机上执行安装程序 - 通过发出请求。


Is it accessible locally? No. It is present on the server and the code, Process.Start() will be executed on the server as well. The client is barely the trigger in this case, and any action on the server-side will not tell him anything, and just as mentioned in Solution 1, the admins will also not let you execute an installer on their machine — by issuing a request.

Quote:

我正在尝试从Web应用程序安装.exe。当我在本地运行应用程序(从asp开发服务器)它正在正确安装。

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

因为,在那一刻,它将在同一台客户端计算机上可用,并且由于您拥有管理员权限,因此您可以知道文件的位置。这就是它正常运作的原因。

Because, at that moment it will available on the same client machine, and things go well as you have the admin rights, and you know where the file is. That is why it works properly.

Quote:

但是当我在IIS上托管时它无法正常工作。

But when i hosted on IIS it is not working.

不,应用程序已经使用IIS托管(如何运行ASP.NET应用程序?)唯一的区别是,现在您的应用程序依赖于托管提供商提供的权限。



永远不要使用HTTP请求安装应用程序,即使你知道那里有什么。大多数托管服务提供商都会认为它是恶意应用程序,并会立即终止该过程,或者更糟糕的是,终止合同或订阅。解决方案是,您应该联系管理员,或查看其控制面板中提供的附加组件,然后从中选择一个。他们会很高兴,你的用户也会得到这些服务。

No, application already was hosted using IIS (how else, would you run an ASP.NET application?) the only difference is that now your application is relying on the rights provided by hosting providers as well.

Never install an application, using an HTTP request, even if you know what is there. Most of the hosting service providers will believe it to be a malicious application and will immediately terminate the process, or worse, terminate the contract or subscription as well. The solution is, that you should contact the admins, or look at the add-ons provided in their control panel and select one from there. They will be happy with it, and your users will get the services as well.


错误会告诉你问题是什么,但我可以告诉你,但没有看到它是一个错误权限问题。如果这是您的服务器,则授予运行IIS应用程序池的帐户足够的权限。如果这是一个托管人,你必须问他们,但很确定答案是否定的。
The error would tell you what the problem is but I can tell you without seeing the error that it is a permissions issue. If this is your server then grant the account running the IIS App pool sufficient permissions. If this is a hoster, you'll have to ask them but pretty sure the answer will be no.


这篇关于托管后,System.diagnostics.process进程无法在IIS上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆