从ASP运行服务器端的exe文件(初级) [英] Run a server-side exe from ASP (beginner)

查看:154
本文介绍了从ASP运行服务器端的exe文件(初级)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有什么应该是一个简单的事情,但我与.NET和Web程序的不熟悉是阻碍我。我是一个直线上升老派的C程序员谁已经为电子商务网站最近编程ASP和ASP.NET。

I have what should be a simple thing but my unfamiliarity with .NET and web programs is hindering me. I'm a straight up old-school C programmer who has been programming ASP and ASP.NET lately for an ecommerce site.

我有2同步数据库的ASP程序。我也有编译为填充源数据库中同步发生前的一个EXE程序VB.NET。在我的内心深处,我知道我应该能够在VB&放链接; ASP .NET程序,因为在一起是.NET的力量。另外,如果我可以从ASP运行EXE这将是一样好为我的项目。我有源头上这两个程序。 ASP脚本是用文本编辑器编写 - VB的是VB 2008年防爆preSS

I have an ASP program that synchronizes 2 databases. I also have a VB.NET program compiled down to an EXE that fills the source database before the synch happens. In the back of my mind I know I should be able to link the VB & ASP .NET programs together since that's the power of .NET. Alternatively, if I could run the EXE from ASP it would be just as well for my project. I do have the source to both programs. The ASP script was written with a text editor - the VB was in VB 2008 Express.

请假设我什么都不知道联接组件和这样的,因为我不 - 我只是读了一个文章。我想preFER ASP但如果需要,我可以使用ASP.NET脚本来启动该exe文件。在code是传统的ASP使用VBScript所以我们所有的ASP.NET的东西是VB味为好。 C#使我其他的程序员的头伤得这么为他着想,这将必须保持VB。

Please assume I know nothing of linking assemblies and such because I don't - I just read that in an article. I'd prefer ASP but if necessary I could use the ASP.NET script to launch the EXE. The code is legacy ASP with VBScript so all our ASP.NET stuff is the VB flavor as well. C# makes my other programmer's head hurt so for his sake this will have to remain VB.

有没有一种方法,我可以相对容易地启动EXE pre-sync程序,并将它的ASP脚本同步启动的时候运行?

Is there a way I can relatively easily launch the EXE pre-sync program and have it run when the ASP synch script starts?

该服务器是微软Windows Server 2003的SP2 / IIS 6.0 / .NET版本是2.0.50727.3603。谢谢!

The server is MS Windows Server 2003 SP2 / IIS 6.0 / the .NET version is 2.0.50727.3603. Thanks!

- 我喜欢学会正确使用.NET,但时间很短了这个项目,并深入研究将不得不等待

By the way - I'd love to "learn to use .NET properly" but time is short for this project and in-depth research will have to wait.

编辑:下面阿龙的回答让我最的方式来解决,但我发现:

Aaron's answer below gets me most of the way to the solution but I'm getting:

异常详细信息:System.ComponentModel.Win32异常:访问被拒绝结果
源错误:第17行:process1.Start();结果
想法吗?

Exception Details: System.ComponentModel.Win32 Exception: Access is denied
Source Error: Line 17: process1.Start();
Ideas anyone?

解决方案:阿龙的回答下面加上知识〜/在MapPath的是网站,并运行该文件的虚拟根是相对于

SOLUTION: Aaron's answer below plus the knowledge that ~/ in MapPath is the virtual root of the website and the file to run is relative to that.

推荐答案

//创建负责启动新进程的进程类的一个实例。

// Create An instance of the Process class responsible for starting the newly process.

System.Diagnostics.Process process1 = new System.Diagnostics.Process();

//设置目录文件所在

// Set the directory where the file resides

process1.StartInfo.WorkingDirectory = Request.MapPath("~/");

//设置要打开的文件的文件名名称

// Set the filename name of the file you want to open

process1.StartInfo.FileName = Request.MapPath("foo.exe"); 

//启动流程

process1.Start(); 

这篇关于从ASP运行服务器端的exe文件(初级)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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