禁用Visual Studio Web服务器目录浏览 [英] Disable Visual Studio Web Server Directory Browsing

查看:178
本文介绍了禁用Visual Studio Web服务器目录浏览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio的内置网络服务器进行测试和EPiServer应用。当我在IIS中运行该应用程序时,如果我点击了虚拟目录的根目录,则EPiServer将接管默认服务器页面并将其提供给我。使用Visual Studion服务器(出于许可证原因,我正在使用SDK),它始终为我提供网站的目录列表视图。有谁知道如何配置此Web服务器以不允许目录列表/浏览?



其他信息:
仅此问题似乎影响了Visual Studion Web服务器的根(我从这里开始将其称为 cassini)。例如,如果我从localhost:6666运行一个站点,那么我会发现localhost:6666 / en /可以正常工作,并且EPiServer VPP会知道它在做什么。如果我使用localhost:6666 /,则VPP永远不会启动(或接缝)。在我看来,当敲定卡西尼号的根时,它会检查该页面是否存在(因为我没有默认设置,所以页面不存在)。如果它确定该页面不存在,那么它将提供目录列表而不是404。对我来说,第一件事是在卡西尼文件中禁用目录浏览,然后查看为什么未正确执行VPP。 / p>

所以我想问题的基础是:当Visual Studio开始一切工作时,是否可以在Cassini中修改这些settins?



(EPiServer可能是一个红色鲱鱼,但以防万一,它是CMS版本5)



进一步更新
我设法掌握了Cassini 3.5的源代码,然后旋转了一下。在这种情况下,3.5可以正常工作并表现得像IIS。即缺少默认文档不会导致目录列表,而是允许HTTP处理程序执行,然后由EPiServer进行其余操作!所以问题是,我可以在Web服务器上的Visual Studio中达到相同的效果吗?

解决方案

请确保您拥有〜 /Default.aspx文件。它不会呈现,但是在卡西尼语中需要虚拟路径提供者来获得处理 /请求的机会。
当然,如果您还是这么做的话,不妨在起始页上使用它:-)


I'm using Visual Studio's built in web server to test and EPiServer applicaiton. When I have the app running in IIS, if I hit the root of the virtual directory, EPiServer will take over and server the defaul page to me. Using the Visual Studion server (which I am doing for license reasons with the SDK), it always gives me the 'Directory Listing' view of my site. Does anyone know how to configure this web server to not allow the directory listing/browsing?

Additional Information: This problme only seems to effect the root of the visual studion web server (i'll call it cassini from here on in). As an example, if I run a site from localhost:6666, then what I will find is that localhost:6666/en/ will work just fine and the EPiServer VPP will know what it is doing. If I use localhost:6666/, then the VPP never kicks in (or so it seams). It seems to me that when the root of cassini is hit, it checks to see if the page exists (which it does not as I have no default). If it decides that the page does not exist, then it serves up the directory listing, rather than 404. The first thing to do for me is to dispable directory browsing in cassini, then look at why the VPP is not being actioned correctly.

So I suppose the base of the question is: Is there a way to modify these settins in Cassini when it is Visual Studio starting everything off?

(EPiServer may be a red herring, but just in case, it's CMS version 5)

Further Update I managed to get hold of the source for Cassini 3.5 and gave that a whirl. 3.5 works just fine and behaves like IIS in this instance. I.e. the lack of default document does not lead to a Directory listing, rather if allows the HTTP handlers to kick in and then EPiServer does the rest! So the question is, can I achieve the same in Visual Studios effort at a web server?

解决方案

Make sure you have a ~/Default.aspx file. It won't render, but it's needed in cassini for the virtual path providers to get a chance to handle the request for '/'. Of course, if you make it anyway you might as well use it for the start page :-)

这篇关于禁用Visual Studio Web服务器目录浏览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆