[Mono-list] Server using mod_mono

Mike Morano mmorano@mikeandwan.us
Wed, 7 Jul 2004 23:26:39 -0400

Hi Patrick,
	By unmask, I assume this means you have all the mono 1.0 packages emerged 
(you would have had to do something like: ACCEPT_KEYWORDS="~x86" emerge 
mod_mono).  xsp and mono should also be installed as dependencies for 
mod_mono.  If not, I would highly recommend you starting with the 1.0 
	The configuration for apache is actually much simpler than before, and no 
longer requires that you manually start the mod-mono-server, because 
apache/mod_mono can now do this when needed.
	The configuration from my gentoo box is as follows:

DocumentRoot /var/www/localhost/www
MonoExecutablePath "/usr/bin/mono"
MonoServerPath "/usr/bin/mod-mono-server.exe"
MonoApplications "/:/var/www/localhost/www"
MonoApplicationsConfigFile "/var/www/localhost/mono.webapp"
LoadModule mono_module     extramodules/libmod_mono.so

<Directory /var/www/localhost/www>
    #SetHandler mono
    AddHandler mono .aspx .ascx .asax .ashx .asmx .cs .config

    <IfModule mod_deflate.c>
      SetOutputFilter DEFLATE

    DirectoryIndex index.aspx
    Options -Indexes FollowSymLinks MultiViews
    AllowOverride All

    <IfModule mod_access.c>
      Order allow,deny
      Allow from all

Note: You will need to create the following file.  You can put it anywhere you 
like, but make sure it is referenced properly in the apache2.conf file, on 
the MonoApplicationsConfigFile.
        <!-- vhost and port are ignored in xsp.exe -->

Once you have made these updates, make sure all mono processes are killed 
(killall mono), and then restart apache.  Once it starts, just point your 
browser at your site.

Hope this helps,

On Wednesday 07 July 2004 10:30 pm, Patrick Stockton wrote:
> I am trying to get mod_mono and apache2 working on a Gentoo Linux box.  I
> have been programming C# & ASP.NET for about 2 years and using Linux for
> over 6.  I am brand new to Mono.
> I have unmasked the ebuilds for the mod_mono package and it complied and
> installed just fine.
> I have modified my apache2.conf file to linclude the following:
> 	AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
> 	LoadModule mono_module modules/mod_mono.so
> 	MonoUnixSocket /tmp/mod_mono_server
> 	Alias /mono "/home/patrick/www.codejnki.com/dotnet/"
> I have changed to the directory I am trying to server pages from and run
> this command:
> 	mono /usr/bin/mod-mono-server.exe --root . --applications /mono:.
> After the mod-mono-server starts I
> 	chmod 666 /tmp/mod_mono_server
> 	chown apache:apache /tmp/mod_mono_server
> At this point I try to pull up my test page which looks like this:
> 	<%@Page language="c#" %>
> 	<% string s = "HELLO WORLD"; %>
> 	TEST: <%= s %>
> At which point I promptly get an error page that looks like this:
> 	Server error in '/mono' application
> 	Description: Error processing request.
> 	Error Message: HTTP 500.
> 	Stack Trace:
> 	System.NullReferenceException: Object reference not set to an instance of
> an object in <0x00049> System.Web.QueueManager:.ctor ()
> 	in <0x00077>
> System.Web.HttpRuntime:OnFirstRequestStart(System.Web.HttpContext)
> The first time I pull up the page nothing is displayed in the console that
> I am running the mod_mono_server from.  If I try to pull up the page a
> second time the following is output to the console:
> System.NullReferenceException: Object reference not set to an instance of
> an object
> Server stack trace:
> in <0x00061> System.Web.HttpRuntime:ProcessRequest
> (System.Web.HttpWorkerRequest) in <0x0000a>
> Mono.ASPNET.MonoWorkerRequest:ProcessRequest ()
> in <0x0004f> Mono.ASPNET.BaseApplicationHost:ProcessRequest
> (Mono.ASPNET.MonoWorkerRequest) in <0x00056> (wrapper
> remoting-invoke-with-check) Mono.ASPNET.BaseApplicationHost:ProcessRequest
> (Mono.ASPNET.MonoWorkerRequest)
> in <0x0011c> Mono.ASPNET.ModMonoApplicationHost:ProcessRequest
> (int,string,string,string,string,string,int,string,int,string,string[],stri
>ng[]) in (unmanaged) (wrapper managed-to-native)
> System.Runtime.Remoting.RemotingServices:InternalExecute
> (System.Reflection.MonoMethod,object,object[],object[]&)
> in <0x00004> (wrapper managed-to-native)
> System.Runtime.Remoting.RemotingServices:InternalExecute
> (System.Reflection.MonoMethod,object,object[],object[]&)
> in <0x00171>
> System.Runtime.Remoting.RemotingServices:InternalExecuteMessage
> (System.MarshalByRefObject,System.Runtime.Remoting.Messaging.IMethodCallMes
> Exception rethrown at [0]:
> in <0x00601> System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke
> (System.Runtime.Remoting.Proxies.RealProxy,System.Runtime.Remoting.Messagin
> The only thing that shows up in the apache error log is this:
> 	[Thu Jul 08 22:46:59 2004] [notice] child pid 26346 exit signal
> Segmentation fault (11)
> Needless to say I am totally stumped here.  The message is obviously
> comming from the mod_mono_server.  It is formatted the same as error
> messages I get from IIS servers.  It looks like something crashed but I'm
> not sure why or where to begin to look.  Any help in tracking down this
> error would be greatly appreciated.
> Thanks
> Patrick
> ---
> [This E-mail scanned for viruses by Declude Virus]
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list