Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Mono capable of hosting ASP.NET MVC WebAPI in mod_mono yet?

Pretty much as the title says - I've tried to get this going as per:

http://www.integratedwebsystems.com/2011/12/get-started-with-amazon-ec2-run-your-net-mvc3-razor-site-in-the-cloud-with-linux-mono-2/

And whilst I can get a very simple ASP MVC 4 site going - anything with a WebAPI project involved gives me 500s and very cryptic errors in my apache logs:

System.NullReferenceException: Object reference not set to an instance of an object
  at System.Web.Util.HttpEncoder.GetCustomEncoderFromConfig () [0x00000] in <filename unknown>:0 
  at System.Lazy`1[System.Web.Util.HttpEncoder].InitValue () [0x00000] in <filename unknown>:0 

I'm guessing not but want to know if I'm doing something basic wrong!

Cheers.

like image 262
Kieran Benton Avatar asked Jan 02 '13 18:01

Kieran Benton


1 Answers

As of Mono 3.0.2, ASP.NET WebAPI is not yet supported. WebAPI uses HttpRequest.GetBufferlessInputStream() to get the HTTP request data, but this is not yet implemented in Mono. If you get past the errors mentioned above (which may be due to incorrect configuration in Web.config), you will encounter an error similar to this error:

Missing method System.Web.HttpRequest::GetBufferlessInputStream() in assembly /opt/mono-3.0.0/lib/mono/gac/System.Web/4.0.0.0__b03f5f7f11d50a3a/System.Web.dll, referenced in assembly /tmp/www-data-temp-aspnet-0/2956977a/assembly/shadow/5cf10065/cf4140da_93b040bf_00000001/System.Web.Http.WebHost.dll

See https://bugzilla.xamarin.com/show_bug.cgi?id=8008 for the bug report.

like image 118
Daniel Lo Nigro Avatar answered Oct 20 '22 01:10

Daniel Lo Nigro