从网站调用exe应用程序 [英] Calling a exe App from a Web Site

查看:70
本文介绍了从网站调用exe应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想找到一种方法从ASP.NET / c#Web应用程序中调用用C#编写的.exe应用程序。我有以下内容:



Hi All,

I am trying to figure out a way to call a .exe application written in C#, from within an ASP.NET/c# Web Application. I have the following:

Process p = new Process();
p.StartInfo = new ProcessStartInfo(@"C:\<filePath>\<filename>.exe", "00000170");
p.StartInfo.UseShellExecute = true;
p.StartInfo.RedirectStandardOutput = false;
p.Start();





调用.exe文件可以正常工作。我的问题是在.exe应用程序中,抛出的任何异常都应该写入文本文件。以这种方式调用应用程序时不会发生这种情况。当.exe在Web应用程序外部调用时,它会按预期工作。



有人可以帮忙解决异常输出吗?



此外,Web应用程序可以调用.exe应用程序,让它在后台运行然后继续进行自己的处理而无需等待.exe完成执行。 Web应用程序不依赖于.exe的结果。



谢谢



The call to the .exe file works fine. My issue is within the .exe application, any exceptions thrown should be written to a text file. Which isn't occurring when the application is called this way. The .exe works as expected when it is called outside the Web application.

Can anyone help with the exception output please?

Also, it would be great is the Web application could call the .exe application, let it run in the background but then continue on with it's own processing without waiting for the .exe to finish executing. The Web application is not reliant on the results from the .exe.

Thank you

推荐答案

对.exe文件的调用工作正常。



我真的,如果我是你真的不太确定......


在你再继续之前我会在生产环境中检查它。为什么?因为C#代码是在服务器上执行的,而不是客户端,并且在开发中它们在同一台计算机上似乎工作正常并没有在生产中做任何有用的事情......
"The call to the .exe file works fine."

I really, really wouldn't be too sure about that if I was you...

I'd check it in a production environment before you go any further. Why? Because the C# code is executed on the Server, not the Client, and what seems to work fine in development where they are the same computer doesn't do anything useful in production...


这篇关于从网站调用exe应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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