Tag: monorail3

Deploy a full Castle (Core, Windsor, ActiveRecord, MonoRail3) app in the cloud using mono and mysql

The VM

I use Digital Ocean, their VM are fast, reliable and cheap. The 5$ one is good enough for starter and you can easily upgrade later on if you need more power.

Setting up the environment

MonoRail3 runs on .Net Framework 4.0 and for some reasons doesn’t play well with mono 2.10. So you need to install mono 3.0 and then set-up your app with mod_mono.

1. Install required packages for building mono 3.0
sudo apt-get install build-essential libgtk2.0-dev
2. Follow these steps here to build mono 3.0
3. Configure mod_mono
Simplest and efficient way is to use Mod_mono AutoHosting. Don’t forget to use mod_mono 4.

Setting up your Project

Using Visual Studio 2012 start a new Empty Web Application and add the following nu-get packages:
– Castle Windsor log4net integration
– Castle.Activeecord
– MySql.Data
– Castle MonoRail 3.0

Your Global class should inherit from MrBasedHttpApplication.

Add some routes and then you’re ready to go 🙂

Caveats

1. Enumerable in a view are not working (can’t GetEnumerator on type object error)

I’ve not seen this documented anywhere, but if you use an enumerable in a view you need to make your view inherit from blade typed viewpage like this:


@inherits Castle.MonoRail.Blade.ViewPage<IEnumerable<YourTypeHere>>

2. MonoRail2 did integrate seemlessly with Windsor even if it could work without it, didn’t find how to with MR3 yet.

I’ll keep looking around and post back.

Cheers,