执行从ASP.NET一个EXE [英] Executing an EXE from ASP.NET

查看:154
本文介绍了执行从ASP.NET一个EXE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从一个ASP.NET MVC应用程序中执行一个exe。是的,我明白,这样做的固有风险,但不幸的是我真的需要做到这一点。

I'd like to execute an exe from an ASP.NET MVC application. Yes I understand that inherent risks of doing this, but unfortunately I really need to do it.

该EXE是一个GUI应用程序,但论据我通过它迫使它运行默默它会生成一些数据到一个zip文件,然后退出。

The EXE is a GUI application, but the arguments I pass it force it to run "silently" where it generates some data into a zip file and then quits.

在code执行EXE如下 - 它运行在我的开发VS2008很好 - 但是当我测试针对实际的服务器(Server 2003中 - IIS6),它失败:

The code to execute the EXE is as follows -- it runs fine in VS2008 on my development box -- but when I test against the actual server (Server 2003 - IIS6), it fails:

        ProcessStartInfo psi = new ProcessStartInfo();
        psi.FileName = "C:\.....";
        psi.Arguments = "-silent -file outFile.zip";

        Process proc = new Process();
        proc.StartInfo = psi;
        proc.Start();

        proc.WaitForExit();
        log.Debug("Process exited: " + proc.ExitCode);

退出code是:-532459699,所以很明显的东西出了问题。

The exit code is: -532459699, so something obviously went wrong.

我在服务器上运行的应用程序通过身份验证的HTTPS连接(基本身份验证),所以我想我能够通过设置来解决这个问题<身份冒充=真 /> ℃在Web.config文件;&的System.Web GT; 标记。但是 - 这没有奏效

I am running the application on the server over an authenticated HTTPS connection (basic authentication), so I thought I'd be able to get around the problem by setting <identity impersonate="true" /> in the Web.config file under the <system.web> tag. But -- that hasn't worked.

感谢 - 所有帮助AP preciated

Thanks -- all help is appreciated.

推荐答案

所以,模拟建议很有趣,但最终我的问题是与我的控制台应用程序本身。它试图写一些日志文件,以用户的应用程序数据目录(甚至与 -silent 选项...),我没想到。

So the impersonation suggestions were interesting, but ultimately my problem was with my console app itself. It was trying to write some log files to the user's application data directory (even with the -silent option...), which I wasn't expecting.

删除这些碎片(从而使它坚持以 -silent 命令),使一切工作完全

Removing those pieces (thus making it adhere to the -silent command) made everything work perfectly

这篇关于执行从ASP.NET一个EXE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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