从ASP.NET Web应用程序运行.exe时出现问题 [英] Issue while running .exe from ASP.NET web application

查看:103
本文介绍了从ASP.NET Web应用程序运行.exe时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我们......

我们有一个.exe,我们需要在网站上下订单时执行.exe。当我们在本地测试它时工作正常但是当我们将它移动到IIS7时,它会失败。我们如何执行.exe文件?

代码:

Pls hlp us...
We have a .exe which we need to execute at the time an order is placed on a website. When we test this locally it works fine but When we move it to IIS7, it fails. How do we execute the .exe file ?
code:

var fileprocess= new Process
                          {
                              StartInfo = new ProcessStartInfo
                                              {
                                                  FileName = exePath,
                                                  Arguments = arglist,
                                                  UserName = username,
                                                  Password = Password,
                                                  Domain = domain,
                                                  
                                                  UseShellExecute = false,
                                                  LoadUserProfile = true
                                              }
                          };

        fileprocess.Start();
        fileprocess.WaitForExit();
        fileprocess.Close();

推荐答案

由于安全性,您无法将此类exe作为Web应用程序的一部分运行。在开发机器上运行时,您可能拥有自己的凭据,这很可能具有管理员权限。

在IIS下,您在网站/应用程序池用户的上下文中运行,而该用户主要是第一周没有像运行exe这样的权限。

您可以将该用户当然改为一个正确的用户,但我建议您重新考虑您的设计。 Web应用程序中没有可执行文件的位置。当您的网站活跃时,它可能会导致非常大的安全/资源/性能问题!如果你的设计告诉你使用这样的exe你的设计是错误的......
You fail to run such exe as part of a web application because of security. While running on the development machine you are uder your own credentials, that most probably has administrator rights.
When under IIS you run under the context of the web site/application pool user, and that user mostly a week one with no rights like running exe.
You can change that user of course to one with proper right, but I suggest to rethink your design. There is no place for executable in a web application. It can lead a very huge security/resource/performance problem when your site goes alive! If your design tells you to use such exe your design is wrong...


你为什么不使用javaScript在客户端机器上执行exe。我建议这是因为我也遇到了同样的问题。它在本地机器上工作正常但在托管之后无法正常工作。它显示在任务栏中,但窗口不可见。



检查链接。



如何使用HTML应用程序执行本地文件? [ ^ ]
Hi why don't you use javaScript to execute the exe on client machine. i am suggesting this because i have also faced the same problem. it was working fine in local machine but after hosting it was not working. It was showing in task bar but window was not visible.

check the link.

How to execute a Local File using HTML Application?[^]


这篇关于从ASP.NET Web应用程序运行.exe时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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