从 cgi 脚本中运行 .net consolapp

发布于 2024-08-27 13:39:34 字数 646 浏览 4 评论 0原文

我写了一个简单的cgi python 脚本,看起来像这样,

#!c:/Python25/python.exe -u
import cgi
import os
def main():
    print "Content-type: text/html\n"
    form = cgi.FieldStorage()
    print form["firstname"].value
    os.execvp("D:\\path\\to\\my\\consolapp.exe", [""])

    main()

正如你所看到的,我想启动一个我在.net 中编写的控制台应用程序。

但是当我调用 cgi 脚本时,我的控制台应用程序崩溃了。因此,我在 .net 程序中执行了一些操作后进行了一些调试并编写了一个文本文件。

结果是每次我想打开 access mdb 文件时我的程序都会崩溃。它告诉我,我需要 Microsoft 数据访问组件 (MDAC)。但我无法相信这个消息,因为如果我自己启动它,我的 .net consoleapp 运行不会出现错误。

那么任何人都可以给我一些建议,我如何通过网页脚本调用我的.net consol ab。

我很高兴收到每一个建议,所以它不一定是使用 cgi 脚本的解决方案。

问候, 尼科

i have written a simple cgi python script which looks like this

#!c:/Python25/python.exe -u
import cgi
import os
def main():
    print "Content-type: text/html\n"
    form = cgi.FieldStorage()
    print form["firstname"].value
    os.execvp("D:\\path\\to\\my\\consolapp.exe", [""])

    main()

As you can se i'd like to start a consoleapp which i have written in .net.

But my consoleapp crashs when i call the cgi script. So i did a little debuging and write a text file after some actions i do in my .net program.

The result was that my programm crash everytime i'd like to open a access mdb file. It told me that i need the Microsoft Data Access Components (MDAC). But i cant belive this message because my .net consoleapp runs without errors if i start it from my own.

So can anybody give me some advise how i can call my .net consol ab through a webscript.

I'm happy for every advise So it don't have to be a solution using a cgi script.

Regards,
Nico

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月隐月明月朦胧 2024-09-03 13:39:34

我已经找到答案了。

你必须安装mod_python。之后这个Python脚本就可以工作了:

import subprocess

def index():
    subprocess.Popen(["E:\\test\\TestTabNormalisator.exe"])
    return 'Done.'

希望这对其他人也有帮助。

I have found the answer.

You have to install mod_python. After that this Python Script works:

import subprocess

def index():
    subprocess.Popen(["E:\\test\\TestTabNormalisator.exe"])
    return 'Done.'

Hope this will help other too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文