Today I decided that I wanted to try out deploying a ASP.NET MVC + Web Api application on Ubuntu.
Why do I want to do that? Well I have always loved C# and .NET, however I have never really enjoyed the Microsoft ecosystem. I am glad that Mono is around and have often wondered What if C# and .NET had targeted all platforms?
I wanted to get MVC 4 and Web API to work correctly. So after spending a few hours on it I thought I would share it with you all.
Below will outline the steps that I took to get this working. I will leave the blood and tears to myself.
Vagrant.configure("2") do |config|
config.vm.box = 'quantal64'
config.vm.provision :shell, :path => 'bootstrap.sh'
config.vm.network :forwarded_port, guest: 80, host: 9000
The bootstrap.sh contained the following:
apt-get install -y git
apt-get install -y nginx
apt-get install -y g++
apt-get install -y gettext
apt-get install -y pkg-config
apt-get install -y automake
These packages will be used to build mono and the web-server Once you have all this set up is just as easy as saying vagrant up and vagrant ssh
Once you have logged-in into the box you will run the following commands:
- wget http://download.mono-project.com/sources/mono/mono-3.0.7.tar.bz2
- tar -xvjpf mono-3.0.7.tar.bz2
- cd mono-3.0.7
- ./configure --prefix=/usr/local
- sudo make install
Once all that finishes you will need to get web-sever to work:
- git clone https://github.com/mono/xsp
- cd xsp
- ./autogen.sh --prefix=/usr/local
- sudo make install
To test if it works create yourself a simple example project or use the one I made. To get the development web server up run sudo xsp4 --port 80 and go to http://localhost:9000/api/service/test. You should see the following:
I will be going through some of the MVC 4 and Web API 4 features to make sure it all works. Once that is done I will try to do this on AWS by creating an AMI so that I can test some release processes. Thanks for reading and hope this was just as exciting for you as it was for me.