Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Mono 3.2.0 with .NET MVC 4

I am trying to get Mono 3.0 setup to run MVC4 sites under .NET 4 and .NET 4.5. I've been working through various errors, what can I do to get it up and running?

Server Configuration

  • CentOS 5
  • Apache 2.2.3
  • 3.2.0 (tarball Sun Jul 28 00:57:40 UTC 2013); ASP.NET Version: 4.0.30319.17020 2013)
  • Latest XSP from git, as of the time of this post

Apache/Mono Config

MonoServerPath "/usr/local/bin/mod-mono-server4"

/usr/local/bin/mod-mono-server4 contents:

#!/bin/sh
exec /usr/local/bin/mono $MONO_OPTIONS "/usr/local/lib/mono/4.5/mod-mono-server4.exe" "$@"

Update

The crux of the problem is that Mono doesn't ship with MVC4 which the site requires. It still has the MVC3 dlls, yet it has the Razor 2 dlls but not the Razor 1 dlls which MVC3 wants to sue.

like image 794
Brian Avatar asked Jul 27 '13 17:07

Brian


People also ask

What is Microsoft ASP.NET MVC 4 runtime?

ASP.NET MVC 4 is a framework for developing highly testable and maintainable Web applications that follow the Model-View-Controller (MVC) pattern. The framework encourages you to maintain a clear separation of concerns— views for UI, controllers for handling user input, and models for domain logic.

Is ASP.NET MVC still used?

ASP.NET MVC is no longer in active development.

What isasp net MVC?

ASP.NET MVC is a web application framework developed by Microsoft that implements the model–view–controller (MVC) pattern. It is no longer in active development. It is open-source software, apart from the ASP.NET Web Forms component, which is proprietary.

What is. net MVC used for?

The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System. Web.


1 Answers

Everything you need is now available within the Mono framework or on NuGet. I've created downloadable template for MVC4 for .Net 4.0 and .Net 4.5 and some notes on resolving the issues:

http://www.cafe-encounter.net/p1510/asp-net-mvc4-net-framework-version-4-5-c-razor-template-for-mono-on-mac-and-linux

The steps from the blog post are:

  • git clone github.com/chrisfcarroll/AspNetTemplatesForMono/Mvc4CSharpRazorFx45Intranet NB This github repo includes all the required dlls in case you don’t have NuGet working, so it’s an oversized download.
  • Open the solution in Xamarin Studio. It almost works out-of-the-box. The one thing you have to do is choose one of these 2 steps to make it work:

Either delete Microsoft.Web.Infrastructure.dll from the bin\ directory and from the project

Or, from the command line:

sudo mkdir /Library/Frameworks/Mono.framework/Versions/3.2.5/etc/mono/registry
sudo chmod g+rwx /Library/Frameworks/Mono.framework/Versions/3.2.5/etc/mono/registry

(replacing 3.2.5 with your mono version, which you get at the command line with mono --version);

The Microsoft.Web.Infrastructure.dll is required on .Net on Windows, so deleting it is not the simpler approach if you want cross-platform deployability

like image 182
Chris F Carroll Avatar answered Sep 25 '22 03:09

Chris F Carroll