开发者

Compile C# as CGI

How do you compile a C# program as C开发者_如何学GoGI to run in the cgi-bin of a LAMP/Linux/Apache server?


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


You usually compile C programs using the compiler on the server, often the gnu compiler. If this is the complier you are using then;

gcc -o <name_of_output_file>.cgi <name_of_source_file>

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;

chmod 755 <name_of_file>

This is how I do it for C, C# I imagine is the same.


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.:

#!/usr/bin bash

/usr/bin/opt/mono myprogram.exe $@

(Of course, just using Apache with mod_mono is a much better solution, if you can.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜