[Mono-list] ASP.NET + Apache (mono-cgi / mod_mono)

Simon Waite simon@psionics.demon.co.uk
Sun, 1 Sep 2002 14:32:12 +0100


After a very busy week or two, I've managed to find time to 
do more work on the framework that will support ASP.NET on 
Apache, and other web servers.

Presently I'm working on the cgi version that will work with
Windows Apache, and use the Microsoft Runtime, as it will be 
slightly easier to learn C# and how to build HttpWorkerRequest,
than to include grafting the runtime into a module, and having
to learn a whole bunch of new stuff on top of a difficult task.
:-)

I've been keeping relatively quiet on this matter on the list
due to the fact that I'm reluctant to announce a project that
may or may not turn out to be vapourware! Though I've been
mostly active on irc.gnome.org / #mono and mostly pestering 
people there for help (thanks people!).

Well, perhaps now is the time to 'announce' a partially 
finished project :-) 

Stage One: SimpleWorkerRequest CGI

First proof of concept embedding ASP.NET into a CGI

This works great for 'SimpleWorkerRequest' functionality is
limited to the GET method, but still it runs many of Gonzalos
tests; even the button one once I modified it to use GET rather
post :-) The speed isn't fantastic (considering IIS appears to
hold as much compiled asp.net stuff as possible in memory) but
the fact is that it works. 

Just to reiterate for the more excitable of you:
YES, this is on WINDOWS APACHE with MICROSOFTS RUNTIME



Stage Two: MonoWorkerRequest (CGI)

This is a framework to create a single HttpWorkerRequest Class
and have further 'plug-in' objects that will directly interface
to the various APIs that are available for plugging into 
webservers. This is similar to PHP having different SAPI drivers
but with a core that is the scripting engine.

Currently I'm working on the plug in for CGI as it is the 
simplest and most well common and understood of APIs. 
At the moment I'm currently attempting to design a good pattern 
to aquire Forms data, and file upload data. - I'm quite amused 
that according to some ASP forum posts I've read IIS appears to
hold file upload requests in memory before (potentially) writing 
then out to disk, I've not even seen any documentation to limit
the size of uploading files (Potential IIS DoS ?) obviously I
might be mistaken and there it might be documented somewhere 
how to limit this :-)

I was hoping that I would have been able to have finished this
stage by last Monday, but real life took over :(


Stage Three: MonoWorkerRequest part two

This is a little further away, and several options present 
themselves; (This is a braindump :-)


1. Embedding the Microsoft/Mono Runtime directly in Apache

   This is like how the current mod_php works.

   In my opinion that embedding Microsofts runtime into
   Apache is best for Microsoft partners and licensees, as
   this might be seen as contaminating the Mono project.

   The mono runtime is embeddable at the moment, but I'm
   not sure of the stability of the API - how much is it
   going to change? Is it in a state of flux?

   Security, the embedded runtime will run with the same
   credentials as the web server - so will be okay for a
   single hosting environment, but for a mass hosting 
   environment it throws up a few security issues (ie.
   being able to read database passwords in clear text
   by reading the aspx source code)

2. A small apache module that embeds mono, and uses remoting 
   to convey the information to a stand-alone application.

   Although for this you probably don't have to embed mono 
   or use remoting if a simple protocol is written.

   A small cgi app would perhaps be advisable to write to
   flesh out the protocol, obviously the protocol has to 
   be simple enough to extract as much performance as 
   possible.

   This is how I understand chillisofts' asp to work, and
   how Apache/JServe worked, so the technology is kinda
   well known and there should be some research available.
   Also this is how Covalent appears to do it, according
   to the diagram on their website :-)



Rest assured though, I'm (still) working on it, and apologies
to Gonzalo who is probably waiting for this so he can test
HttpRuntime, etc. 

Regards

Simon