MVC Framework with mod_aspdotnet
Brought to you by:
wrowe
From: Electronjockey <ele...@ho...> - 2010-04-12 19:16:26
|
Apache 2.2.15 with mod_aspdotnet built on VS 2008 from latest source. I just wanted to share with the group my latest success. I have MVC 1.0 and 2.0 up and running on Apache using our little module. Cracking MVC 1.0 wasn't too too bad. I managed to get several configurations working, but the one below is the simplest. It is a matter of configuring the <Directory> using the SetHandler directive to asp.net. This will force all requests to be handled by the module. Since that means all requests, including static content, you can end up with some odd output if you don't exclude it. I did this in the <Location> directive setting the SetHandler to none. Alternatively you could list out file extensions. <Directory "/htdocs/MvcApplication1"> # Set custom headers <IfModule headers_module> Header set X-Powered-By "ASP.NET" </IfModule> SetHandler asp.net Options FollowSymlinks AspNet Files Virtual Order allow,deny Allow from all DirectoryIndex Default.aspx </Directory> <Location ~ "^/MVCTest/Content/.*"> SetHandler none </Location> MVC 2.0 was only a little more complicated because it eliminated the Default.aspx physical file, which was little more than a placeholder. I had to employ mod_rewrite to force a 301 to the home controller at /home. <Directory "/htdocs/MVC2TestApp"> # Set custom headers <IfModule headers_module> Header set X-Powered-By "ASP.NET" </IfModule> Options FollowSymlinks SetHandler asp.net AspNet Files Virtual Order allow,deny Allow from all RewriteEngine On RewriteBase /MVC2Test/ RewriteRule ^$ Home [R=301] </Directory> <Location ~ "^/MVC2Test/Content/.*"> SetHandler none </Location> |