[Mono-aspnet-list] How to run mono as cgi?

Kornél Pál kornelpal at gmail.com
Sun Oct 17 05:32:17 EDT 2010


The fcgi server described on that page acts like a daemon but is 
launched on demand rather than being registered as a system service 
(each distro/OS has different solutions for that). Being said even if 
your hosting provider kills you daemon process sometimes or 
(periodically) you still get the advantage of avoiding startup cost for 
several requests. The next request after fcgi server termination will 
respawn the fcgi server.

Another advantage for the hosting provider is that only a single process 
will use considerable CPU and memory resources. If you really used CGI, 
each request would consume considerable memory resources, and 
intialization would require addition CPU resources for each request.

And note that cgi-fcgi is a conventional CGI application that acts as a 
fsctcgi gateway so you need no fastcgi support in the web server.

If you still prefer to use CGI, you can do that:
- Create a shell script to launch you exe using mono
- AOT compile everything you use to avoid code generation overhead
- Even with such a setup ASP.NET may be too heavy

ASP.NET was designed to live inside a daemon:
- Create app domains for each application
- Processes multiple requests on separate threads
- The first request takes much more time because initialization

Although there is no HttpWorkerRequest for CGI I believe that all of 
your requests were handled extremely slow.

If you want to try CGI you should use a console exe without ASP.NET, 
that is you should use environment variables, Console.In and Console.Out 
(or Read/Write methods).


Bear worte:
> hi,
> I have read that page. But unfortunately, my hosting provider deny me
> from running any daemon on it. So I do not think fastcgi is suitable for
> me. Is there any way to run mono without run a daemon? thx!
> On 2010/10/16 下午 10:20, Kornél Pál wrote:
>> Hi,
>> This should work for you:
>> http://www.mono-project.com/CGI
>> Kornel
>> jilingshu wrote:
>>> hi there,
>>> I have build and installed mono into my own home folder in my
>>> hosting. My
>>> hosting provider is Dreamhost and it told me I cannot run any daemons
>>> on it.
>>> So could you tell me is there any way for me to run mono as cgi
>>> instead of
>>> fastcgi? thx!

More information about the Mono-aspnet-list mailing list