Setting up Mono 2.8 with Asp.Net 4.0 and MVC2 on Ubuntu with MySql Membership

I’ve had a few requests to write a full walk-through installing Mono 2.8 w/ Asp.Net 4.0 since I posted an install script for Mono 2.8 on Ubuntu and Fedora.  So here it is! We’re going to be setting up a new server from scratch then installing just the basics of Mono 2.8 (Mono, GTK, GDI, XSP, & Mod_Mono). Then we’ll use that to setup a new Apache server with a basic Asp.Net 4.0 MVC2 application w/ MySql Membership.  That sounds like a lot, but it’s really very straight forward. So lets get started!

Update! 1/30/2011

Mono 2.8.2 has become available since this article was posted and is highly recommended due to security enhancments. Refer to install script for Mono 2.8.2 instead of 2.8. Pay close attention to your virtual host config so you use the correct mono install prefixes. Check MonoServerPath and MonoSetEnv directives below.

Setup Your Server

For our server, we’re going to setup a VM of 32 bit Ubuntu Server 10.04 LTS using VirtualBox. You can use whichever VM software you want or setup a physical server. This is just an easy sandbox system for this walkthrough. I noticed VirtualBox requires hardware virtualization for 64bit guest systems; keep that in mind if you test with a 64bit server.

I applied default configuration settings to my VM with 512 RAM and a bridged network interface so I could communicate with it directly from another machine. After that, I mounted the Ubuntu Server install ISO to the disc drive and booted it into installation.  During installation, the only package option I enabled was the OpenSSH Server (use arrows, spacebar, and tabs to move around the installer).  I’m not going to worry about other things like a web server since the Mono installer script will do that for us. Once you’ve completed the installer, unmount the ISO, boot up, and login. It defaults to using DHCP for ethernet, so find the current IP using:

ifconfig eth0

Using the IP Address listed here, connect to the box with an SSH client of your choice (I tend to use Putty or the OpenSSH client built into msysGit on Windows).  Immediately update your server. If you haven’t used “sudo” before, it will request your sudo password, which is just your normal account password you setup during install.

ssh nathan@ubuntu
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get upgrade -y

 

Install Mono

Once you’re updated, we can download the install script and install Mono, Apache, and dependencies.

wget --no-check-certificate https://github.com/nathanb/iws-snippets/raw/master/mono-install-scripts/ubuntu/install_mono-2.8.shchmod 755 install_mono-2.8.sh./install_mono-2.8.sh

This will re-run another update and then download, compile, and install everything required to run Mono 2.8. It will also compile and install other Mono-related items like: GTK, GDIPlus, XSP, and Mod_mono. Once it completes, update your system path and reboot. Edit “/etc/environment” and insert “/opt/mono-2.8/bin:” to the beginning of the PATH value.

Once completed, refer to this more recent post about setting up MVC, which also includes information about setting up your environment for the new install. You can test it with “mono –V”.

nathan@ubuntu:~$ mono -V
Mono JIT compiler version 2.8 (tarball Mon Nov 15 14:39:28 CST 2010)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none
        Misc:          debugger softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)
nathan@ubuntu:~$

 

So now we just need to configure Apache. The install process copied a mod_mono.conf to the directory: /etc/apache2.  You’ll need to enable this by moving it to /etc/apache2/mods-available and creating a link to that file at /etc/apache2/mods-enabled.

cd /etc/apache2
sudo mv mod_mono.conf mods-avail*
sudo ln -s /etc/apache2/mods-available/mod_mono.conf /etc/apache2/mods-enabled/mono.conf

#optionally restart apache server. more changes coming
sudo service apache2 restart

 

Configure Website

We’re using Mod_Mono to handle Asp.Net requests with Apache. I’ve mentioned before that I’m a big fan of the Mono website’s Mod_Mono configuration tool. We can use that tool to build our initial VirtualHost configuration. Then change the MonoServerPath to be the one we installed at: “/opt/mono-2.8/bin/mod-mono-server4”  When you’re done, upload (or move) this folder to your home directory on the server.

NOTE: We’re using mod-mono-server4 for Asp.Net 4.0 runtime. You can use mod-mono-server2 for 2.0-3.5 Asp.Net and mod-mono-server for 1.0-1.1 Asp.Net.

NOTE: If you’re unfamiliar with copying files from your Windows box to a Linux one, you can use FileZilla with an SSH (SFTP) connection. Connect to something like: “sftp://username@host” then treat it like any other FTP connection.

Here we’ll setup our web folders, permissions, move our configuration file, link it, and restart the web server. Our generated configuration file is named ubuntu.conf and was uploaded to my home folder.

sudo mkdir /srv/www
sudo mkdir /srv/www/ubuntu
sudo chown root:www-data /srv/www/ubuntu -R
sudo chmod 775 /srv/www/ubuntu -R
mv ~/ubuntu.conf /etc/apache2/sites-available
cd /etc/apache2/sites-en*
sudo ln -s ../sites-available/ubuntu.conf "000-ubuntu.conf"
sudo service apache2 restart

NOTE: I prefixed the link name with “000” since Apache loads configuration files in alphabetical order. It’s not necessary for this scenario, but if you’re running multiple virtual hosts and want a “default”, this is good to know. Make your default VirtualHost load first.

You might also want to give yourself permissions to write to the new web directories for publishing sites. The easy way to do this (maybe not best practice), would be to add yourself to the www-data group used by apache & mono, which we just setup with full access.

sudo usermod -a -G www-data your_username

Later when we upload the site, this will be a factor. The alternative will be to upload your published site to your home directory and then with an ssh console, sudo mv the published files to the web directories if you choose not to add yourself to the www-data group.

For this sample, we used all the default parameters in our configuration. Take note that debugging is enabled. I also left IO Mapping enabled to allow Mono to treat file system paths as case insensitive. You can improve performance by disabling IO Mapping. The VirtualHost configuration looks like this:

<VirtualHost *:80>
  ServerName ubuntu
  ServerAdmin web-admin@ubuntu
  DocumentRoot /srv/www/ubuntu
  # MonoServerPath can be changed to specify which version of ASP.NET is hosted
  # mod-mono-server1 = ASP.NET 1.1 / mod-mono-server2 = ASP.NET 2.0
  # For SUSE Linux Enterprise Mono Extension, uncomment the line below:
  # MonoServerPath ubuntu "/opt/novell/mono/bin/mod-mono-server2"
  # For Mono on openSUSE, uncomment the line below instead:
  MonoServerPath ubuntu "/opt/mono-2.8/bin/mod-mono-server4"

  # To obtain line numbers in stack traces you need to do two things:
  # 1) Enable Debug code generation in your page by using the Debug="true"
  #    page directive, or by setting <compilation debug="true" /> in the
  #    application's Web.config
  # 2) Uncomment the MonoDebug true directive below to enable mod_mono debugging
  MonoDebug ubuntu true

  # The MONO_IOMAP environment variable can be configured to provide platform abstraction
  # for file access in Linux.  Valid values for MONO_IOMAP are:
  #    case
  #    drive
  #    all
  # Uncomment the line below to alter file access behavior for the configured application
  MonoSetEnv ubuntu MONO_IOMAP=all;LD_LIBRARY_PATH=/opt/mono-2.8/lib:$LD_LIBRARY_PATH;PATH=/opt/mono-2.8/bin:$PATH
  #
  # Additional environtment variables can be set for this server instance using
  # the MonoSetEnv directive.  MonoSetEnv takes a string of 'name=value' pairs
  # separated by semicolons.  For instance, to enable platform abstraction *and*
  # use Mono's old regular expression interpreter (which is slower, but has a
  # shorter setup time), uncomment the line below instead:
  # MonoSetEnv ubuntu MONO_IOMAP=all;MONO_OLD_RX=1

  MonoApplications ubuntu "/:/srv/www/ubuntu"
  <Location "/">
    Allow from all
    Order allow,deny
    MonoSetServerAlias ubuntu
    SetHandler mono
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
  </Location>
  <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
  </IfModule>
</VirtualHost>

 

Create and Publish Asp.Net MVC2 Application

In Visual Studio 2010, select the File menu –> New –> Project. In the new project dialog near the top center, select the .NET Framework 4.  Then on the left, select Web (under C#), and choose ASP.NET MVC2 Web Application.  There are a few key items we’ll need to remove to make this compatible with Mono.

First, open the ~/Models/AccountModels.cs file and remove all data annotations attributes from the three model classes’ properties. You may leave “DisplayName”. I’ve found (without investing a lot of time in this), that the data annotations doesn’t seem to work out of the box. Removing these attributes will allow it to run properly under Mono. Keep in mind, this also means, you’ll need to write your own server-side validation. It’s not too painful; we’ve been doing this for  years anyway.

Finally, build and test-run the site from visual studio. It should work fine with the built-in Casini test web server. If all is well, right click on the project (in solution explorer) and Publish the site. Publish it to the file system and choose a destination folder. You don’t need to include the App_Data folder, and you can delete all files before publish if you want.

Upload the published files to the server using FileZilla, and copy them to /srv/www/ubuntu.  Apache doesn’t need to be restarted when you update web files and assemblies. You should now be able to browse the site at http://your_test_server_host/.  All should work except membership since we haven’t configured the database yet.

 

Setup Membership with MySql

Awhile back, I wrote a post dedicated to MySql Membership with a simple config generation tool do this for you. Checkout the post for more details after setting up your database server. Setting up membership is identical between Asp.Net MVC and web forms. Install and configure MySql Server first. Then setup a placeholder database for the membership data. The first time you use membership during runtime will automatically generate the database schema.

Install MySql and Setup Empty Membership Database

sudo apt-get install mysql-server

NOTE: The default install will lock it down to localhost access only, which is good for a server. But for test, if you want to access it from your machine, you’ll have to tell it to bind to a LAN address (instead of 127.0.0.1). Take a peek at /etc/msyql/my.cnf file to update this setting. The comments describe the change.

I’m giving application user full access (including schema change privileges) to the membership database. MySql Memebrship provider updates its own schema as you update the provider.  Checkout the MySql docs if you want to limit account privileges.

nathan@ubuntu:~$ mysql -h localhost -u root -p
mysql: create database membership;
mysql: grant all privileges on membership.* to 'aspnet_user'@'localhost' identified by 'secret_password';
mysql: quit

Configure Membership

I used my configuration tool and generated a simple membership config.  Copy the membership sections to your into the “system.web” section of your root web.config and setup a connection string with the same name as the one used in membership. (“Default” is used here).

Next, if you’re using a factory default version of MySql Connector/NET, you’ll need to download its source and recompile it with .NET 4.0 profile. I found while doing this that the published 2.0 version seemed to blow up when referencing transaction methods. I found that it was a known bug and should be resolved in upcoming versions of the connector. For now, you’ll need to recompile MySql.Web and MySql.Data with a 4.0 profile if you want it to work under Mono with membership.  The sample version packaged here has that done already.

NOTE: The version of MySql .NET Connector I was using at the time I wrote this tool (6.3.5) didn’t support hashed passwords with Mono runtime. I made a minor tweak to this version that will disable the Mono runtime check for hashed passwords and will allow it (since it does work in the current version of Mono). 

<authentication mode="Forms">
    <forms
      loginUrl="~/Account/Logon"
      timeout="30"
      name="6ad58f32-93d5-463f-9d99-835942aca8f5"
      path="/"
      requireSSL="false"
      slidingExpiration="true"
      defaultUrl="Default.aspx"
      enableCrossAppRedirects="false"/>
</authentication>

<membership defaultProvider="MySqlMembershipProvider">
    <providers>
        <clear/>
        <add name="MySqlMembershipProvider"
              type="MySql.Web.Security.MySQLMembershipProvider, mysql.web"
                connectionStringName="Default"
                enablePasswordRetrieval="false"
                enablePasswordReset="true"
                requiresQuestionAndAnswer="false"
                requiresUniqueEmail="true"
                passwordFormat="hashed"
                maxInvalidPasswordAttempts="5"
                minRequiredPasswordLength="6"
                minRequiredNonalphanumericCharacters="0"
                passwordAttemptWindow="10"
                applicationName="/"
                autogenerateschema="true"/>
    </providers>
</membership>

<roleManager enabled="true" defaultProvider="MySqlRoleProvider">
    <providers>
        <clear />
        <add connectionStringName="Default"
            applicationName="/"
            name="MySqlRoleProvider"
            type="MySql.Web.Security.MySQLRoleProvider, mysql.web"
            autogenerateschema="true"/>
    </providers>
</roleManager>

<profile>
    <providers>
        <clear/>
        <add type="MySql.Web.Security.MySqlProfileProvider, mysql.web"
              name="MySqlProfileProvider"
              applicationName="/"
              connectionStringName="Default"
              autogenerateschema="true"/>
    </providers>
</profile>

 

Also for Mono, I added the DbProviderFactories section for MySql data in case it wasn’t already setup. Insert this adjacent to the <system.web> section.

<system.data>
    <DbProviderFactories>
        <clear/>
        <add name="MySQL Data Provider"
            description="ADO.Net driver for MySQL"
            invariant="MySql.Data.MySqlClient"
            type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>
    </DbProviderFactories>
</system.data>

Once updated, you should now be able to run the MVC app and register/authenticate user accounts. If you have any problems, double-check your data source value, username and password. Make sure you can connect to it with a mysql client and your app credentials.  Also I find the Asp.Net Configuration Tool built-in to Visual Studio helpful when testing Membership configuration. It will show you a number of users and roles if membership is configured properly.

 

Sample

Grab the sample from here or github. Includes: Web App, dependencies, & virtual host config. Comments, enhancements, pull requests, are welcome!

 

Wrap-Up

So now we’re done. The next thing you should checkout is how to use inversion of control with MVC2. I’ve been writing applications lately using SubSonic3 (repository mode) and Unity Application Block 2.0 for dependency injection. Coupled with MvcContrib test helpers and Rhino Mocks, this is a powerful combination for writing rock solid, testable applications that run on Windows AND Mono.

Here are a few useful links for this post:

34 thoughts on “Setting up Mono 2.8 with Asp.Net 4.0 and MVC2 on Ubuntu with MySql Membership

  1. @MrBronz

    That was a link to the github raw version of the file. Try this one (same thing). Also, I noticed the line feeds were missing from your comment. It’s possible you’re running all three commands at once.


    wget https://github.com/nathanb/iws-snippets/raw/master/mono-install-scripts/ubuntu/install_mono-2.8.sh --no-check-certificate

    then do:
    chmod 755 install_mono-2.8.sh

    then:
    ./install_mono-2.8.sh

  2. Thanks for that

    Confirmed that I have mono 2.8 installed

    Also followed your steps to Create a new project however, removing the data annotations attributes stops the project from compiling and running, but that another task for later.

    I used your example for creating the server eg ‘ubuntu’ but when I goto http://ubuntu, I get the http://www.ubuntu.com site….

    Am I missing a localhost from my address? I have tried lots of combinations but still I cant get to the site.

    Any suggestions?

  3. Hi Nathan
    I tried to install using the fedora scripts on centos 5.4 machine. installation script did not report any errors but the file /opt/mono-2.8/bin/mod-mono-server* are not present. However mono -V works fine.
    I tried recompiling mod_mono expecting issues form it but no luck. Not sure whats wrong. Can you please help.
    Regards – sai

  4. Nevermind! figured out that I was having same issues as the one pointed by @rgb in the other thread http://www.integratedwebsystems.com/2010/10/mono-2-8-install-script-for-ubuntu-fedora/

    - I have solved it by installing the latest sqllite by doing this.
    wget http://www.sqlite.org/sqlite-amalgamation-3.6.10.tar.gz
    tar -xvf sqlite-amalgamation-3.6.10.tar.gz
    cd sqlite-amalgamation-3.6.10
    ./configure –prefix=/usr
    make
    sudo make install

    - After this I re ran the installation. Everything went smoothly.

  5. Hi @Saiprasad

    It sounds like XSP did not install. Since the rest of Mono seemed to install okay, don’t re-run the full script. Just try manually compiling XSP alone and see if it shows any errors.


    cd xsp-2.8
    make

    It should tell you if it’s missing any dependencies for XSP. You should be able to install them with the system packager or manually install them if the OS hasn’t packaged the right version. Once you resolve those and get XSP compiling successfully, install it with:

    sudo make install.

  6. A tip about compiling MySql Connector/Net 6.3.5 under GNU/Linux with Monodevelop 2.8.1: trying to build the MySql.Web project results in a compilation error about MembershipProvider not being found.

    To resolve this problem, you have to add a reference to System.Web.ApplicationServices, the assembly where MembershipProvider, RoleProvider etc. reside.

  7. Hello Nathan,

    I couldn’t make my own ASP.NET 3.5 MVC 2 project (made from VS 2008) work with my own compiled version of MySQL Connector/NET, so I tried your own project, and it works! Thank you: it saved me a lot of troubleshooting.

    However, I had to make some modifications in order to make it work in Monodevelop 2.4.1 and Mono 2.8.1 under GNU/Linux (Kubuntu 10.10).

    1. Remove the reference to “System.Web.Entity” in the SampleASP4MVC2.Web project.
    2. Remove the targetFramework=”4.0″ attribute from the Web.config.
    3. Replace “mysql.web” by “MySql.Web” in the “type” attributes of “add” tags in “membership”, “roleManager” and “profile” tags.

    However, if I register an account and try to log on later on, it doesn’t work. I get an error saying my password or username is incorrect.

    If I switch to clear passwords by putting passwordFormat=”clear” in the Membership provider configuration (web.config), and recreate my user, I can log on afterwords.

    It does seem like hashed passwords are not supported.

  8. @SylvainC
    Glad you got it working! Thanks for the helpful tips!

    Yeah, I had to make a few tweaks to this project. Mono supports hashed passwords in 2.8+, but the actual MySql connector itself has them disabled by throwing an exception if you try to use them. I disabled that check in this version of the connector.

    Also, if you download their source for the MySql connector, make sure the built assembly filne name case matches the reference you’re using. In my case, I think the assembly name in the project properties was all lowercase so the file name had to match; otherwise, Mono doesn’t like it.

    I haven’t tried to use it in MonoDevelop yet, but thanks for the heads up. I’ll check that out for sure.

  9. I got error .

    I use mysql membership.
    asp.net mvc 2 website on ubuntu 10.10 + mono 2.8.2 + mysql connector 6.3.6.
    my passwordformat is Clear.

    I use asp.net mvc default memberi view and controller.
    mono got error :

    The requested feature is not implemented.

    System.ComponentModel.DataAnnotations.DataTypeAttribute.IsValid (System.Object value)
    /tmp/mono-2.8.2/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataTypeAttribute.cs:80

    I checked mono class status page.

    http://go-mono.com/status/status.aspx?reference=4.0&profile=4.0&assembly=System.ComponentModel.DataAnnotations

    it’s complete … why?!

  10. @Jerry
    Great! Glad you got that. I was going to say, to make the vanilla project work, you have to remove the data annotations from the account model classes. I hear it’s supposed to work, but I haven’t ironed out the details since I tend not to use the data annotations as much.

    Also, you can use encrypted or hashed passwords with Mono now, but you have to tweak the MySql.Web code a little so it ignores that it’s running on Mono. I recall doing that for this sample project.

  11. Thanks man!
    How can i automate the publish? Web deployment doesn’t seems to make the trick because websites deployed with web deployment tool don’t work with xsp

  12. @razvan

    That’s odd. What doesn’t work about it? Are you getting error messages?

    I’ve been using that for my deployments. It should work in both VS Express and full editions of 2008 and 2010. Make sure you set your web project references to “Copy Local” for System.Web.Mvc and System.Web.Routing. You may also need to define your data providers in the <system.data> configuration section for whatever provider you’re using (mentioned in the post). Also, if you’re using Asp.Net 2.0 – 3.5, then configure your virtual host to use mod-mono-server2 instead of 4.

  13. Hi Nathan,

    I’m running the default mono install on Ubuntu 10.10, which is 2.6.7. I’ve got ASP.NET MVC working nicely. I have been able to use the MySqlMembershipProvider with passwordFormat=”Clear”

    When I use Encrypted passwords, I’m able to register a new user and see their user name show up at the top of the page. The password and password key are in the database, both encrypted. But when I go to log in again, it says the password is invalid.

    Creating another user with the same password, yields a new password and passwordKey in the database.

    I would assume some sort of salting is happening, but I thought that only happened with hashed passwords.

    Any ideas? If you could go into a bit more detail on your changes to the MySqlConnector, I can do the same for the .NET 2.0 version of the connector. I’ve downloaded the source for the 6.3.6 version.

    I was considering implementing my own Encryption in the MySqlConnector, but figured I’d try here first.

    Thanks for the great tutorials! They helped me setup ASP.NET MVC (Mono) @ Rackspace.com using their cloud offering. Much cheaper than a hosted windows server in the cloud :)

    Thanks again,

    -Joe Barbere

  14. @Joe Barbere

    You bet! Well, that question might have somewhat of a complicated answer. :) But I might be able to lead you in the right direction. If you’re using encrypted passwords, try specifying the machinekeys manually. I wrote a tool for this here.

    The actual change I made to the MySql Membership Provider was just disabling the check they made for the Mono Runtime. They check for Mono and then disallow hashed passwords if Mono is detected. Mono 2.6 and newer support the hashing API used by the provider so the check isn’t necessary. Check the configuration initialization in the src\MySql.Web\Providers\Source\MembershipProvider.cs file.

    Good Luck!

  15. Thanks Nathan! I finally got it working. You were right, I just needed to remove the check in the Initialize method, and now hashed passwords are working. I tried using Encrypted passwords with my own encryption class, but it still generated a different encrypted password each time, the Encrypt method was called. I think there is something wrong with the algorithm, but I’m not versed enough in cryptography to figure it out.

    Now to just get ELMAH working with routing and I should have an awesome open source development platform!

    Ubuntu Linux – MySql – Apache2 – mod_mono – mono 2.6 – ASP.NET MVC 1- HTML5 – jQuery – log4net – Castle ActiveRecord – NHibernate – Elmah

    Hopefully I will be implementing LINQ, ASP.NET MVC 2, and NHibernate.Spatial in the next few weeks.

  16. @Joe Barbere
    Excellent!! Nice job! That’s so funny. I just ran into the exact same thing recently. I just got ELMAH working on mine. I actually recoded the ELMAH lib to work with System.Web.Abstractions too so I could use it for Rhino Mocks and testing. I started writing up a post on it, but my solution was unpredicable; would work sometimes and not others.

    You can try it out though.

    The main problem I had for Mono was getting the pages to render. I could get the root, but nothing else. Try enabling the IIS5 wildcard mapping like this: (Enable them in this order too).


    <httpModules>
    ...
    <add name="FixIIS5xWildcardMapping" type="Elmah.FixIIS5xWildcardMappingModule, Elmah"/>
    <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
    <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
    </httpModules>

  17. Pingback: Anonymous
  18. root@iplist:~# wget –no-check-certificate https://github.com/nathanb/iws-snippets/raw/master/mono-install-scripts/ubuntu/install_mono-2.8.shchmod 755 install_mono-2.8.sh./install_mono-2.8.sh
    –2011-09-02 16:28:03– https://github.com/nathanb/iws-snippets/raw/master/mono-install-scripts/ubuntu/install_mono-2.8.shchmod
    Løser github.com… 207.97.227.239
    Connecting to github.com|207.97.227.239|:443… forbundet.
    HTTP forespørgsel sendt, afventer svar… 404 Not Found
    2011-09-02 16:28:04 FEJL 404: Not Found.

    –2011-09-02 16:28:04– http://755/
    Løser 755… 0.0.2.243
    Connecting to 755|0.0.2.243|:80… mislykkedes: Invalid argument.
    –2011-09-02 16:28:04– http://install_mono-2.8.sh./install_mono-2.8.sh
    Løser install_mono-2.8.sh…. mislykkedes: Name or service not known.
    wget: unable to resolve host address `install_mono-2.8.sh.’

    :( what to do?

  19. Hi.
    I have run the install script from the 2.10.5 version.
    And are trying to continuing on. But what is meant by

    “Once it completes, update your system path and reboot.”

    I cant exactly see what it is you want me to do. Can you please elaborate :p

    Thanks on advance.
    Kind regards

    And ty for the awesome install scripts.

  20. @drenriza ,
    My apologies. This post is a little old and was written before I realized a better way to work with environment settings for custom Mono installs. It’s now my preference to not disturb the native platform version of Mono and instead use a custom installation prefix like /opt/mono-2.8 or /opt/mono-2.10.5 to install these custom scripts. This way it won’t affect anything that the system packager uses for dependencies.

    I updated it with a link to another article I wrote about MVC that briefly covers setting up your environment settings either for an Apache virtual host or a command line environment to consume the new Mono install.

    Thanks! -Nathan

  21. Hi Nathan.
    A little confused. I looked at the new guide you posted to, and its not quite the same.
    So far i have installed the 2.10.5 script and edited my /etc/environment with the /opt/mono-2.8/bin:/ and tested with mono -V and i get the correct result. I was going to move on to

    “So now we just need to configure Apache. The install process copied a mod_mono.conf to the directory: /etc/apache2. You’ll need to enable this by moving it to /etc/apache2/mods-available and creating a link to that file at /etc/apache2/mods-enabled.”

    But now i should go back and follow http://www.integratedwebsystems.com/2011/06/get-mvc3-razor-running-on-mono/ reverting the /etc/environment back? Or should i just continue with the “old” guide? Which is “So now we just need to configure Apache.” What is the enhancement in the new vs the old way?

    Kind regards

  22. Sorry i write a lot. Hope you can delete some of my posts if it gets to much.
    I followed the guide on this page and configured apache to the guide above.

    But i wonder. What file do you edit to display below.

    ServerName ubuntu
    ServerAdmin web-admin@ubuntu
    DocumentRoot /srv/www/ubuntu
    # MonoServerPath can be changed to specify which version of ASP.NET is hosted
    # mod-mono-server1 = ASP.NET 1.1 / mod-mono-server2 = ASP.NET 2.0
    # For SUSE Linux Enterprise Mono Extension, uncomment the line below:
    # MonoServerPath ubuntu “/opt/novell/mono/bin/mod-mono-server2″
    # For Mono on openSUSE, uncomment the line below instead:
    MonoServerPath ubuntu “/opt/mono-2.8/bin/mod-mono-server4″

    I did not copy the whole text. Since i think you know what i refer to.

    My current issue is that i have published my project to my filesystem and moved the files to my server in /srv/www/ubuntu but the /var/www/index.html is what i see when i http://server_ip to my server. Think it has something to do with the last part i cannot locate.

  23. Hi @Patrick Herrington! Thanks!! Be sure and checkout the MVC3 post I did a little while ago following this post. It’s specific to Amazon, but the workflow is nearly the same.

    And, now with Ubuntu 12.04 released, it’s packaged with Mono 2.10.8.1; meaning MVC3 works out of the box without needing to setup Badgerports. – very nice!

  24. Hi @drenriza The issue you’re having is that your custom mono virtual host config (the apache config) is not enabled. And your default site is still enabled. Speaking to Apache only, you’ll be setting up a virtual host (in the example above) to listen to all traffic to that server. It will point to your new web directory and it will enable Mono for that virtual host. You also have to disable the default virtual host config (which points to /var/www). I just did a talk at KCDC ’12 about setting up Mono on Ubuntu 12.04. My recommendation now is to use 12.04 since most of things you need are built-in. And, use the Ubuntu commands for enable/disabling sites. (something I did not mention here).

    So quick answer.. run:

    sudo a2dissite default
    sudo a2ensite ubuntu.conf

    Assuming your custom config you generated from the mono site is named ubuntu.conf.

    Take a peek at my slides for the talk and see if they help at all. Also checkout some of the more recent posts like the Amazon Mono & MVC 3 install which go through these steps at detail for more current tech.

    Hope that helps!

  25. There is error of “Target Framework” as i am bulding the appliocation in .net framework 0.4 so i think it is not compatible for appache server 0.2. what is the solution fior this problem because i have to use .net frame work 0.4

  26. Hi,

    ?
    Could you explain please more details about the .webapp configuration file tags where we should use :
    -the real hostname (Server Name),
    -the web applciation name,
    -the physical directory used to define the virtual host,
    ?
    Because it seams to me realy confused …

    If any given link where I would find technical resources about mod_mono configuraiton, it would be very nice…

    Thanks in advance.
    Ali

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>