Question

Does anyone have any information about getting the current versions of ASP.NET MVC (Preview 5) working on Mono 2.0? There was info on the old versions (Preview 2, maybe Preview 3), but I've seen no details about making Preview 5 actually work.

The Mono Project Roadmap indicates ASP.NET 3.5 for Mono 2.4 (next year). Any ideas on how to get this useful before then?

More details: The basic MVC Preview 5 template seems to work, so long as I avoid the root directory. If I request the root, I get:

Server Error in '/' Application
The virtual path '' maps to another application.

Description: HTTP 500. Error processing request.

Stack Trace:

System.Web.HttpException: The virtual path '' maps to another application.
  at System.Web.HttpContext.RewritePath (System.String filePath, System.String pathInfo, System.String queryString, Boolean setClientFilePath) [0x00000] 
  at System.Web.HttpContext.RewritePath (System.String path, Boolean rebaseClientPath) [0x00000] 
  at System.Web.HttpContext.RewritePath (System.String path) [0x00000] 
  at MvcApplication1._Default.Page_Load (System.Object sender, System.EventArgs e) [0x00000] 
  at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x00000] 
  at System.Web.UI.Control.LoadRecursive () [0x00000] 
  at System.Web.UI.Page.ProcessLoad () [0x00000] 
  at System.Web.UI.Page.ProcessPostData () [0x00000] 
  at System.Web.UI.Page.InternalProcessRequest () [0x00000] 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] 

Version information: Mono Version: 2.0.50727.42; ASP.NET Version: 2.0.50727.42
Was it helpful?

Solution

Well a potential is that RewritePath to / has some sort of bug, so just avoid that. Changing the RewritePath(Request.ApplicationPath) to:

HttpContext.Current.RewritePath("/Home/Index");

Seems to fix the problem, and at least the demo works so far.

OTHER TIPS

Asp.Net MVC 1.0 will work with the 2.4 branch of mono but you will still need to fix the RewritePath in page load of default.aspx.cs

Are you using Mono from svn or stable? What kind of webserver are you using? What kind of Operating system? Do you have rewrite rules in your web server?

I can run preview 4 in Linux with this in the page_load method in default.aspx.cs

HttpContext.Current.RewritePath(Request.ApplicationPath);
 ((IHttpHandler)new MvcHttpHandler()).ProcessRequest(HttpContext.Current);

I need that in windows sometimes too. I didn't test version 5 in Linux yet, so it might not work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top