从 cgi 脚本中运行 .net consolapp
我写了一个简单的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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经找到答案了。
你必须安装mod_python。之后这个Python脚本就可以工作了:
希望这对其他人也有帮助。
I have found the answer.
You have to install mod_python. After that this Python Script works:
Hope this will help other too.