cherokee / webserver

Cherokee Web Server
GNU General Public License v2.0
568 stars 105 forks source link

Detection of ASP.NET / Mono projects should be tweaked #841

Open danielniccoli opened 11 years ago

danielniccoli commented 11 years ago

Original author: daniel@d15.biz (June 08, 2011 06:37:33)

I originally posted this to the mailing list http://lists.octality.com/pipermail/cherokee/2011-June/014844.html) but thought it should actually be posted here.

The Mono wizard (trunk/admin/wizards/mono.py) looks for an index.aspx or default.aspx file. Not all ASP.NET projects contain either of these files. For example, ASP.NET MVC uses URL routing and doesn't actually have physical .aspx files.

I'd probably change the check to look for either Global.asax or Web.config, as both of these should exist in every ASP.NET application. Global.asax is optional but usually included, and Web.config is almost always included (as it has settings for the website, things like database connection details, ASP.NET version information, referenced assemblies, authentication information, etc)

To reproduce: Use the Mono wizard (either a new virtual server or new rule) to set up an ASP.NET website that doesn't contain a default.aspx file.

What is the expected output? Wizard completes successfully

What do you see instead? Error message: "Directory doesn't look like a Mono based project"

Original issue: http://code.google.com/p/cherokee/issues/detail?id=1218

danielniccoli commented 11 years ago

From alobbs on June 08, 2011 08:20:52 Could you please attach a example app that I could use to test it out / fix it up? (We could also use the example-app to add a regression test to ensure any related regression is introduced in the future).

Thanks!

danielniccoli commented 11 years ago

From daniel@d15.biz on June 08, 2011 09:56:54 Certainly. I've attached two minimal example apps - One using WebForms (.aspx files) and one using ASP.NET MVC 3.

To set up either site, go to New virtual server -> Languages -> .NET with Mono, and point it to the directory the files are sitting in. Ensure you use Mono for ASP.NET version 4 (/usr/bin/fastcgi-mono-server4). At present, to create the MVC site, you will need to make a dummy Default.aspx file, and then delete it afterwards.

Note that To make the ASP.NET MVC site work, you will need to edit the default behaviour rule and untick the "Check file" option on the Handler tab.

Expected results: With WebForms: Root shows "This is the home page", and HelloWorld.aspx shows "Hello world" With MVC: Root shows "This is the home page", and /Home/HelloWorld shows "Hello world"

danielniccoli commented 11 years ago

From daniel@d15.biz on June 08, 2011 09:58:05 Forgot to mention - You will need at least Mono 2.10 to get the MVC site working correctly. I am doing all my testing with the Debian package of 2.10.1 (from the "experimental" repository).