将.ashx设置为开始“页面"用于Web应用程序 [英] Set .ashx as start "page" for web application
问题描述
是否可以将.ashx文件设置为Web应用程序的起始(或默认)页面?如果是这样,怎么做?
Is it possible to set an .ashx file as the starting (or default) page for a web application? If so, how is it done?
编辑-一些好的建议.我已经将"Default.ashx"添加到IIS默认文档中,并在网站上添加了已启用默认文档",但是,即使我禁用了目录浏览,它也只显示目录列表.
Edit - Some good suggestions. I have added "Default.ashx" to the IIS Default Documents and "Enabled Default Document" on the website, however, it only displays a directory listing even though I have disabled directory browsing.
任何其他建议将不胜感激. (IIS版本5.1)
Any other suggestions would be appreciated. (IIS Version 5.1)
编辑-重新启动IIS,即可使用.
Edit - Restarted IIS and it works.
问题-我还可以问一下是否可以在Visual Studio 2005中将起始页设置为.ashx吗?完成此操作后,我似乎无法在Visual Studio中进行调试.
Question - May I also ask if it is possible to set the start page to an .ashx from within Visual Studio 2005? I can't seem to debug from within Visual Studio after doing this.
答案-在应用程序属性"中,可以在网络"标签下选择开始操作".实际上,它还允许选择要使用的服务器/端口和调试器.很酷.
Answer - In the Application Properties a "Start Action" can be selected under the "Web" tab. In fact, it also allows the selection of which Server/Port and Debugger to use. Very cool.
推荐答案
添加ASHX页面,并确保将其移至列表顶部.
Add your ASHX page and make sure you move it to the top of the list.
在IIS7中,您可以在web.config中指定它:
And in IIS7, you can specify it in web.config:
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="my_default_page.ASHX" />
</files>
</defaultDocument>
</system.webServer>
编辑:如发现@waves一样,您可能需要在配置后重新启动IIS.
As @waves discovered, you might need to restart IIS after the configuration.
要禁用目录浏览,请取消选中目录浏览"复选框:
To disable directory browsing, uncheck the "Directory Browsing" checkbox:
.
这篇关于将.ashx设置为开始“页面"用于Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!