Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NancyFx (nancyfx.org) root path "/" shows directory listing.
ryanhaney
#1 Posted : Wednesday, February 15, 2012 4:15:19 PM(UTC)
Groups: Member
Joined: 2/15/2012(UTC)
Posts: 3

Was thanked: 1 time(s) in 1 post(s)
Create a new empty ASP.NET Application.

Using NuGet, add the Nancy.Hosting.Aspnet package.

Create a simple NancyModule:

public class SimpleNancyModule : NancyModule
{
public SimpleNancyModule()
{
Get["/"] = _ => "Hello World";
}
}

Run using UltiDev Web Server Pro: note the directory listing.

Run using IIS Express: the server outputs "Hello World"

Ultidev Team
#2 Posted : Thursday, February 16, 2012 10:46:06 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi,

We have tested as you have outlined, but with WebDev instead of IIS Express, in addition to UWS, and got the same result: Nancy's 404 page with the cute, sad monster.

Please attach a test project to your response so we could test for discrepancies.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
ryanhaney
#3 Posted : Friday, February 17, 2012 10:22:37 AM(UTC)
Groups: Member
Joined: 2/15/2012(UTC)
Posts: 3

Was thanked: 1 time(s) in 1 post(s)
Actually, I didn't get a 404 with UWS Pro. I got a directory listing. Attached project has screenshots running in ASP.NET WebDev, UWS Pro 32-bit, UWS Pro 64-bit, and IIS Express 7.5.

WebDev and IIS Express worked as expected.

UWS Pro, regardless of bitness, shows a directory listing.

Note that the issue seems to only exist with the default route "/". If I add another route:

Get["/hi"] = _ => "Hello World 2";

UWS Pro responds to "/hi" as expected.
File Attachment(s):
NancyTest.zip (849kb) downloaded 103 time(s).
1 user thanked ryanhaney for this useful post.
Ultidev Team on 2/17/2012(UTC)
Ultidev Team
#4 Posted : Friday, February 17, 2012 2:42:31 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi!

Thank you for providing sample project. We were able to reproduce the discrepancy and determined that WebDev produces directory listing only after it got 404 in response to the folder ('/') request. Our logic is currently different: we decide whether to serve directory listing in the very beginning: if request for '/' has no default physical file, and directory browsing is turned on (which it is in this case), then our request process decides that instead of risking getting 404, we'll render directory listing. We'll change this behavior in the upcoming build 15. Meanwhile, may either start UWS Interactive Host (with directory browsing switch set to off) as an external debug application for your app, or maybe create and .ashx physical HttpHandler that would simply call Nancy's, and set it as a default doc.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
ryanhaney
#5 Posted : Friday, February 17, 2012 11:08:37 PM(UTC)
Groups: Member
Joined: 2/15/2012(UTC)
Posts: 3

Was thanked: 1 time(s) in 1 post(s)
Thanks for the fix. That worked.

Interesting that Nancy has no concept of a default document. The httphandler for Nancy delegates to NancyModules. If a route is not mapped for "/", a 404 is sent to the client. I would think that UWS would allow the handler to make a decision regarding HTTP status.

I am curious - you said you were getting a 404 in WebDev, where I wasn't. Is this environmental? What OS did you test on?

Also, do we have a rough release date? I am specifically looking for SSL support for customers that do not want to run full IIS.

Thanks again!!!!
Ultidev Team
#6 Posted : Saturday, February 18, 2012 1:06:42 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Great! We are happy it worked.

The problem with always letting handler do its job first is that UWS hosts not only web applications, but also static sites, and if there was a 100% reliable way (for request processing engine) to tell whether the the request is for a static or dynamic resource, for missing static files it wouldn't have to waste time passing the control to ASP.NET pipeline, and could serve 404 as soon as file is not found. Now we have changed this to always have ASP.NET runtime have a crack at serving what looks like 404.

Build 15 is just days away, we are almost code-complete, and working on a client-cert bug that you may see if you run pre-release build 15 and create an SSL endpoint.

We are getting 404 on any URL that is not '/', like '/hi'. Testing on Windows 7 x64.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.