Saturday, October 30, 2010

Troubleshooting ASP.NET 4 MVC app in Mono on Mac OS X

If you received this kind of error in your ASP.NET MVC application in Mono...

Server Error in '/portal' Application

Compilation Error
Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.
Compiler Error Message: : at (wrapper managed-to-native) System.Reflection.MonoMethodInfo:get_method_info (intptr,System.Reflection.MonoMethodInfo&)

...then add this at the end of your httpd.conf:

MonoServerPath /Library/Frameworks/Mono.framework/Commands/mod-mono-server4

...and add this after your AddHandler:

MonoAutoApplication disabled

Complete sample entry in httpd.conf:
Include /etc/apache2/mod_mono.conf

AddHandler mono .aspx .ascx .asax .ashx .config .cs .asmx .axd
MonoAutoApplication disabled

MonoApplications "/:/Library/WebServer/Documents/"

Alias /portal "/Library/WebServer/Documents/HtmlEncoder/"
AddMonoApplications default "/portal:/Library/WebServer/Documents/HtmlEncoder/"
<Location /portal>
  SetHandler mono

MonoServerPath /Library/Frameworks/Mono.framework/Commands/mod-mono-server4

No comments:

Post a Comment