将 C# 编译为 CGI
如何将 C# 程序编译为 CGI 以在 LAMP/Linux/Apache 服务器的 cgi-bin 中运行?
How do you compile a C# program as CGI to run in the cgi-bin of a LAMP/Linux/Apache server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不需要什么特别的 - 只需使用 Mono 的 gmcs 编译器正常编译应用程序即可。
有关集成的更多信息,请查看这两个链接:
http://www.mono-project。 com/ASP.NET
,这个专门用于 CGI:
http://www.mono- project.com/CGI
Nothing special is required - just compile the application as normal with Mono's gmcs compiler.
For more information on integration, check out these two links:
http://www.mono-project.com/ASP.NET
and this one for CGI specifically:
http://www.mono-project.com/CGI
通常使用服务器上的编译器(通常是 gnu 编译器)来编译 C 程序。
如果这是您正在使用的编译器;
无论您为文件命名什么,都需要为其指定扩展名.cgi
然后你所要做的就是将它移动到cgi-bin文件夹中,记住设置程序的权限,通常对于cgi的东西你使用755;
这就是我对 C 的做法,我想 C# 也是一样的。
You usually compile C programs using the compiler on the server, often the gnu compiler.
If this is the complier you are using then;
Whatever you name the file you need to give it the extension .cgi
All You have to do then is to move it to the cgi-bin folder, remember to set the permissions of the program, usually for cgi stuff you use 755;
This is how I do it for C, C# I imagine is the same.
也许,您可以使用一个非常简单的包装脚本,例如使用 bash,它本身以正常方式使用 mono 执行您的 C# 程序。 eg:(
当然,仅将 Apache 与 mod_mono 一起使用就是如果可以的话,更好的解决方案。)
Maybe, you could use a very simple wrapper script, e.g., with bash, that itself executes your C# program with mono in the normal way. e.g.:
(Of course, just using Apache with mod_mono is a much better solution, if you can.)