[Mono-list] info on configuring mod_mono / mod-mono-server.exe - long...

Gonzalo Paniagua Javier gonzalo.lists@ximian.com
Thu, 27 May 2004 01:27:44 +0200


Hi Chris!

First of all, thanks for testing everything and tell everyone about your
experience.

El mié, 26-05-2004 a las 23:24, Chris Turchin escribió:
> Hi,
> 
> it seems like every time I update xsp/mod_mono from cvs, I get to start
> over from zero again and reconfigure everything. Okay, perhaps that is
> the price of living on the "cutting edge" of software development, I can
> live with that. But it occurred to me today, things that used to work no
> longer do, and some things that should work still do not seem to, or not
> as one might expect. And I have no idea which is which...
> 
> The one thing that really bothers / overwhelms me right now is the
> enormous variety of options available for configuring mod_mono /
> mod-mono-server.exe. Here I would like to just list off a few various
> options, I have discovered / stumbled over in the past few weeks which I
> wrote down today... 

The list is long, but in fact, if mod_mono has the same PREFIX as mono
and xsp, you only need MonoApplications or MonoApplicationsConfigFile or
MonoApplicationsConfigDir. The rest of the options have a sane default.

[...]
> MonoApplicationsConfigFile file
> ###############################
> 
> cool, a configuration file with an undocumented syntax. here is the
> syntax for those who would like to know:

Ouch, this is fairly new and I have not documented it yet. I'll do it
today. There's a sample in xsp/test, but well, that's not a public known
location for it.

> 
> <apps>
> <web-application>
>         <name>{appname}</name>
> 	<vhost>{virtual host for application}</vhost>
> 	<vport>{port for the application}</vport>
>         <vpath>{virtual directory in apache}</vpath>
>         <path>{physical path to aspx files}</path>
> </web-application>
> </apps>
> 
> This I learned by trial and error today: if you do not need a setting
> (e.g. vhost or vport), get rid of the entire element! an emtpy element
> value e.g. "<vhost></vhost>" is does bad things...

I will fix this too.

> 
> 
> ApplicationConfigDir
> ####################
> 
> Add ApplicationConfigDir and you can have a whole slew of config files
> with an undocumented syntax and undocumented naming convention to
> configure your webapps with... (they need to be named *.webapp, btw...).
> mod-mono-server.exe.config

Same here, sorry.

> ##########################
> 
> Almost forgot all about that one! The mod-mono-server.exe.config file
> which also has some settings and configuration options.
> 
> I have to admit: i had forgotten about the settings here entirely, and
> the fact that blogx was being registered as an application twice (once
> here and once in httpd2.conf) was a source of strangeness in my setup i
> suspect...)   
> 
> Some settings here seem no longer supported - at least i get the message
> "--applications option is depreciated" when starting mod-mono-server.exe
> as a result of the MonoApplications setting in my config - but this was
> at least a good hint that i had better "grep -R" for "blogx" in /etc and
> /usr and /usr/local (I don't use it, but just in case) and /data/web and
> probably also /var/www (since that is where .wapi/ wants to live now)
> and maybe also /home - because _somewhere_ it is being read/referenced
> for the configuration and I had no idea where... so i did this, found
> that and removed it from there...
> 
> For the record, these are the settings one can configure via
> mod-mono-server.exe.config:
> 
> MonoApplications -- depreciated
> 
> MonoServerRootDir -- analog MonoDocumentRootDir from httpd2.conf
> 
> MonoServerDefaultIndexFiles -- e.g. index.aspx, if left blank it
> defaults to: "index.aspx", "Default.aspx", "default.aspx", "index.html",
> "index.htm" 
> 
> MonoApplicationsConfigDir -- analog httpd2.conf option
> MonoApplicationsConfigFile -- analog httpd2.conf option
> UnixSocketFileName -- analog MonoUnixSocket httpd2.conf option
> 
> perhaps one could consolidate the naming in these two places?

Right. Adding to my TODO list.

> 
> Command Line Options to mod-mono-server.exe
> ###########################################
> 
> Most if not all settings above can be set via command line. See "APP. 1"
> below for the output of "mod-mono-server.exe --help"
> 
> More Useful references to mod_mono & mod-mono-server.exe stuff include
> ######################################################################
> 
> http://www.go-mono.com/archive/xsp-0.10.html -- good config info
> http://www.go-mono.com/asp-net.html#mod_mono -- general info

I'll update this too.

> http://www.go-mono.com/faq.html#asp -- general info
> http://localhost/server-info -- your own module configuration ;-)
> http://apacheworld.org/modmono/ -- very old.

That's the web page for Daniel Ridruejo's page. Really outdated info in
there.

> http://primates.ximian.com/~gonzalo/mono/blog/index.php -- Gonzalo's
> blog

[...]
> Case One: start mod-mono-server.exe via httpd2.conf with MonoRunXSP:
> ####################################################################
> 
> ** doesn't work for me  currently. following appears in err_log:
> 
> [Wed May 26 21:30:00 2004] [error] Not running mod-mono-server.exe
> because no MonoApplications specified.
> 
> *** but I was using:
> MonoApplicationsConfigFile "/data/web/monoconf/apps.config"
> 
> *** Okay, try again, with an app defined. now I get this in err_log:
> 
> ** (/usr/bin/mod-mono-server.exe:5712): WARNING **: Invalid sequence in
> conversion input
>  
> Unhandled Exception: System.TypeInitializationException: An exception
> was thrown by the type initializer for System.Diagnostics.TraceImpl --->
> System.Configuration.ConfigurationException: Error reading
> /usr/etc/mono/machine.config() ---> System.NullReferenceException: A
> null value was found where an object instance was required.

There was a bug in CVS that cause static constructor not to be called.
That was the problem. I think Patrik already fixed it or has a patch.

> Option Two: Start mod-mono-server via apache init script
> ########################################################
> 
> *** again, i get this wierd exception...
> 
> ** (/usr/bin/mod-mono-server.exe:3575): WARNING **: Invalid sequence in
> conversion input

No idea about the warning. The rest is the same issue as before.

> Option three: start mod-mono-server by hand as apache user
> ##########################################################
> 
>  *** attempt 1)
> 
> -sh-2.05b$ /usr/local/bin/mod-mono-server
>  
> ** (/usr/bin/mod-mono-server.exe:2810): CRITICAL **: : shared file
> [/var/www/.wapi/shared_data-arcteryx-1-0] open error: No such file or
> directory
>  
> ** (/usr/bin/mod-mono-server.exe:2810): CRITICAL **: : shared file
> [/var/www/.wapi/shared_data-arcteryx-1-0] open error
>  
> ** (/usr/bin/mod-mono-server.exe:2810): WARNING **: Failed to attach
> shared memory! Falling back to non-shared handles
> See: http://www.go-mono.com/issues.html#wapi for details

Your user didn't have permissions to create a directory in /var/www?
[...]
> *** Okay, so all of a sudden it is looking for /var/www/.wapi instead of
> the /tmp/.wapi as defined in httpd2.conf - fine, i will create it. chown
> it to apache and then...next attempt:
> 
> -sh-2.05b$ /usr/local/bin/mod-mono-server
> Adding applications from config file '/data/web/monoconf/apps.conf'
> Registering application:
>     Host:          any
>     Port:          any
>     Virtual path:  /blogx
>     Physical path: /data/web/blogx
> Registering application:
>     Host:          any
>     Port:          any
>     Virtual path:  /gd-gallery
>     Physical path: /data/web/gd-gallery
> Registering application:
>     Host:          any
>     Port:          any
>     Virtual path:  /Doogle
>     Physical path: /data/web/Doogle
> Registering application:
>     Host:          any
>     Port:          any
>     Virtual path:  /test
>     Physical path: /usr/share/doc/xsp/test
> Listening on: /tmp/mod_mono_server
> Root directory: /data/web
> chowning mod_mono_server
> 
> *** beautiful, it works!! As apache, I can start mod-mono-server.exe via
> my bash script. So I assume starting it via my init script would work --
> but alas, I just same error as above in "Option one"...
> 
> [I hope by consolidating this here, people can at least google for
> things listed/documented in this mail and find them in a mailing list
> archive somewhere]


Thanks for all this information and feedback. I'll work on the
documentation issues you raised.

-Gonzalo