Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
apache & mod_mono (asp.net)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
zambizzi
Guru
Guru


Joined: 28 Aug 2004
Posts: 581
Location: Boise Idaho

PostPosted: Sat Apr 09, 2005 2:57 pm    Post subject: apache & mod_mono (asp.net) Reply with quote

I'm trying to run some of the web apps I developed in C# for asp.net (.net framework 1.1) on Mono/mod_mono but am thus far having no success.

I've added the "-D MONO" flag in /etc/conf.d/apache2 and everything appears to be configured correctly...I guess. XSP is running w/o error...and apache has given me no clues (nothing in error_log about this).

Here's what I get:

http://zambizzi.net/index.aspx

"Service unavailable..."

I'm using the following combination:

Apache 2.0.53
Mono 1.1.6
mod_mono 1.0.6

Here's my mod_mono config:

Code:

<IfDefine MONO>
        # Set this to False if you manage your ASP.Net server through
        # /etc/init.d/mod-mono-server
        MonoRunXSP False

        <IfModule !mod_mono.c>
                LoadModule mono_module modules/mod_mono.so
        </IfModule>

        <IfModule mod_mime.c>
                AddHandler mono .aspx .ashx .asmx .ascx .asax .config .ascx
        </IfModule>

### please also add "-D MONO_DEMO" in order to activate out-of-the-box mono demo
###
        <IfDefine MONO_DEMO>
                <IfModule mod_alias.c>
                        Alias /mono "/usr/share/doc/xsp/test"
                </IfModule>

                MonoApplications "/mono:/usr/share/doc/xsp/test"

                <Directory /usr/share/doc/xsp/test>
                        <IfModule mod_access.c>
                                Order allow,deny
                                Allow from all
                        </IfModule>
                        <IfModule mod_dir.c>
                                DirectoryIndex index.aspx
                        </IfModule>
                </Directory>
        </IfDefine>
### MONO_DEMO end.

</IfDefine>


If you noticed this at the top of the config:

Code:

        # Set this to False if you manage your ASP.Net server through
        # /etc/init.d/mod-mono-server
        MonoRunXSP False


Since I'm running XSP, should this be set to true? I don't have a "mod-mono-server" in my /etc/init.d so I'm not sure what that is...couldn't search it in portage either...any clues there?

I realize that the Mono & mod_mono ebuilds I'm using are hard-masked but I get the same exact results w/ the current "stable" version so I'd rather use the latest to get some of the .NET 2.x features, if possible.

Can anyone help me out?

Thanks!

EDIT:

I set the MonoRunXSP line to True, rebooted apache & xsp, and it did not change.

EDIT:

I tried the last two suggestions in this thread w/ no luck:

https://forums.gentoo.org/viewtopic-p-1949269-highlight-xsp.html#1949269
Back to top
View user's profile Send private message
arch4nge1
n00b
n00b


Joined: 11 Aug 2004
Posts: 57

PostPosted: Wed Apr 13, 2005 12:28 am    Post subject: Reply with quote

Hi,

These are the notes I wrote from setting up basic mono and apache. I apologise for their brevity. Hope they help:-

Getting mod-mono working with Apache2

The following is the /etc/apache2/conf/modules.d/70_mod_mono.conf:-
Code:

<IfDefine MONO>
  <IfModule !mod_mono.c>
    LoadModule mono_module extramodules/mod_mono.so
#      LoadModule mono_module /usr/lib/apache2-extramodules/mod_mono.so
  </IfModule>

  <IfModule mod_mime.c>
    AddHandler mono .aspx .ashx .asmx .ascx .asax .config .ascx
  </IfModule>

  AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
  MonoUnixSocket /tmp/mod_mono_server

  # Uncomment this block to enable the xsp samples
  <IfModule mod_alias.c>
    Alias /mono "/usr/share/doc/xsp/test"
  </IfModule>
  MonoApplications "/mono:/usr/share/doc/xsp/test:/aspnet:/var/www/localhost/htdocs/aspnet"
  <Directory /usr/share/doc/xsp/test>
    SetHandler mono
    <IfModule mod_access.c>
        Order allow,deny
        Allow from all
    </IfModule>
  </Directory>
  <Location /mono>
       SetHandler mono
  </Location>
  <IfModule mod_alias.c>
       Alias /aspnet "/var/www/localhost/htdocs/aspnet"
  </IfModule>
  <Directory /var/www/localhost/htdocs/aspnet>
        Options Indexes
        AllowOverride None
        Order allow,deny
        Allow from 127.0.0.1
        Allow from localhost
        AddHandler mono .aspx .ascx .asax. ashx .config .cs .asmx
  </Directory>
  <Location /aspnet>
       SetHandler mono
  </Location>
</IfDefine>
#AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
#MonoUnixSocket /tmp/mod_mono_server
#LoadModule mono_module /usr/lib/apache2-extramodules/mod_mono.so
#MonoApplications "/var/www/localhost/htdocs/aspnet:/usr/share/doc/xsp/test"
#<Directory "/usr/share/doc/xsp/test">
#        Options Indexes
#        AllowOverride None
#        Order allow,deny
#        Allow from 127.0.0.1
#        Allow from localhost
#        AddHandler mono .aspx .ascx .asax. ashx .config .cs .asmx
#</Directory>
#Alias /mono "/usr/share/doc/xsp/test"
#<Location /mono>
#        SetHandler mono
#</Location>
<IfDefine MONO>
  <IfModule mod_mono>
    ProxyPass /mono/ http://127.0.0.1:8079/
    ProxyPassReverse /mono/ http://127.0.0.1:8079/
    Alias /usr/share/doc/xsp/test/ /mono/
  </IfModule>
</IfDefine>

Save the following script as /etc/init.d/mono-server
Code:

#!/sbin/runscript
# Copyright 1999-2003 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-dotnet/mono/files/dotnet.init,v 1.4 2004/06/25 13:22:20 scandium Exp $

MONO=/usr/bin/mono
#SERVER=/usr/bin/mod-mono-server.exe
SERVER=/usr/bin/mod-mono-server
#ROOT=/usr/share/doc/xsp/test
#ROOT=/var/www/localhost/htdocs/aspx
ROOT=/var/www/localhost/htdocs
#APPLICATIONS=/mono
APPLICATIONS=/
SOCKET=/tmp/mod_mono_server

depend() {
        before apache2
}

start() {
   ebegin "Configuring Mod-Mono.............."
#   echo Running Command:
#   echo $MONO $SERVER --root $ROOT --applications "$APPLICATIONS":.&
#   $MONO $SERVER --root $ROOT --applications "$APPLICATIONS":. --nonstop 1>/dev/null 2>/dev/null &
       $SERVER --root $ROOT --applications "$APPLICATIONS":. --nonstop 1>/dev/null 2>/dev/null &
   FIXED=0
   while [ $FIXED = 0 ];do
#      echo "Waiting for $SOCKET to be created"
      if [ -S $SOCKET ];then
#    echo "Change the owner of $SOCKET"
    chown apache:apache $SOCKET
#    echo "Change the permissions on $SOCKET"
    chmod 666 $SOCKET
     FIXED=1
      fi
      sleep 5
   done
   eend
}

stop() {
   ebegin "Stopping Mod-Mono................."
   PROCESS=`ps -ef | grep 'mod\-mono\-server.exe'`
   #echo "$PROCESS"
   for PID in `echo "$PROCESS" | awk '{print $2}'`;do
      #echo "Killing $PID"
      kill $PID
   done
   if [ -S $SOCKET ];then
      rm /tmp/mod_mono_server
   fi
}

Start apache and mono up by doing:-
Code:

/etc/init.d/apache2 start
/etc/init.d/mono-server start

Save the following as test.aspx and place it in /var/www/localhost/htdocs/aspnet
Code:

<%@ Page Language="C#" %>
<html>
<head>
<title>My First ASP.NET Page</title>
<script runat="server">
 protected void Page_Load(Object Source, EventArgs E)
 {
   TimeLabel.Text = DateTime.Now.ToString();
 }
</script>
</head>
<body>
 
 <p>Hello there!</p>
 
  <p>The time is now: <asp:label runat="server" id="TimeLabel" /></p>
 
</body>
</html>

Point the browser to http://localhost/aspnet/test.aspx and if the output is like the following:-
Code:

Hello there!

The time is now: 03/04/2005 11:14:15

then ASP.NET is working on mod_mono.


Cheers
Back to top
View user's profile Send private message
qnx
l33t
l33t


Joined: 25 Jun 2002
Posts: 638
Location: Göteborg, Sweden

PostPosted: Sat Apr 23, 2005 10:01 pm    Post subject: Reply with quote

Nobody has yet replied, so I thought it'd be good idea to say thank you! A simple, yet useful howto, followed it and it's working perfectly, thank you! =)
_________________
Registred Linux user #191143!
Abit NF7-S rev. 2.00 (BIOS v. 2.7)
AMD AthlonXP 2500+ (Barton)
PATA Seagate ST3120022A
SATA Seagate ST3200822AS & Silicon Image 3112 chipset
Gentoo Linux :)
Back to top
View user's profile Send private message
pkimber
n00b
n00b


Joined: 14 May 2005
Posts: 2

PostPosted: Sat May 14, 2005 3:47 pm    Post subject: Getting mod-mono working with Apache Reply with quote

I agree. The how to works perfectly. Thanks for your help.
Back to top
View user's profile Send private message
taskara
Advocate
Advocate


Joined: 10 Apr 2002
Posts: 3763
Location: Australia

PostPosted: Mon May 30, 2005 2:34 pm    Post subject: Reply with quote

could someone please bottle ths guy up? he is gold.

thanks arch4nge1!
_________________
Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer!
Back to top
View user's profile Send private message
beekman001
n00b
n00b


Joined: 16 Nov 2003
Posts: 3

PostPosted: Sat Oct 08, 2005 2:59 pm    Post subject: how use apache2 Reply with quote

Posted on wrong thread
Back to top
View user's profile Send private message
gtrplr
n00b
n00b


Joined: 31 Jan 2003
Posts: 3

PostPosted: Mon Oct 24, 2005 8:41 pm    Post subject: Reply with quote

Hello,
I followed arch4nge1's post exactly. (even cut and pasted parts of it in) When I load the test.aspx up in my browser, I get "Hello there!
The time is now: "
no time. I have emerged mono and mod_mono in apache2. Could someone help please, I am not sure what details are needed.
Back to top
View user's profile Send private message
mw007
Apprentice
Apprentice


Joined: 08 Nov 2004
Posts: 260

PostPosted: Thu Nov 03, 2005 3:23 am    Post subject: Reply with quote

Hello!

I followed the howto posted above. I don't get any errors, but the pages are not run as they should. When I goto the url: http://localhost/aspnet/test.aspx I get the actual page text (the html and c# code). Any ideas on how I can get this to run?

Thanks in advance!
Back to top
View user's profile Send private message
Alien_Freak
n00b
n00b


Joined: 28 Sep 2003
Posts: 19

PostPosted: Mon Dec 26, 2005 5:17 am    Post subject: one more request... Reply with quote

Is there any way to allow a user to run aspx scripts?

ie. http://localhost/~user/script.aspx or http://localhost/~user/asp/script.aspx?

I'd love to see a tutorial on that....or a howto
Back to top
View user's profile Send private message
gr0x0rd
Guru
Guru


Joined: 12 Aug 2006
Posts: 311

PostPosted: Tue Mar 18, 2008 9:03 pm    Post subject: Reply with quote

I followed arch4nge1's instructions exactly and it worked perfectly. I just had to change the path instances in the 70_mod_mono.conf from extramodules/mod_mono.so to modules/mod_mono.so .

Thank you for this thread!!
_________________
~g
emerge -FML...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum