Net异常:The Web server is configured to not list the contents of this directory.
  IqZfZM3LERO9 2023年11月02日 43 0


阅文时长

| 0.76分钟

字数统计

| 1231.2字符

主要内容

| 1、引言&背景 2、解决方案 3、声明与参考资料

『.Net异常:The Web server is configured to not list the contents of this directory.』

编写人

| SCscHero

编写时间

| 2022/2/5 PM4:53

文章类型

| 系列

完成度

| 已完成

座右铭

每一个伟大的事业,都有一个微不足道的开始。

一、引言&背景   完成度:100%

a) 应对问题

在修改了Debug > General > “Open debug launch profies UI” > IIS Express > App URL的设置后。发现原来可用的Swagger路由跳转变得不可用了,把App URL的设置还原后还是不可用。代码没有任何修改,只动过启动URL。




Net异常:The Web server is configured to not list the contents of this directory._Visual Studio


详细异常如下:

HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.

Most likely causes:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

Things you can try:
If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing.
Go to the IIS Express install directory.
Run appcmd set config /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the server level.
Run appcmd set config ["SITE_NAME"] /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the site level.
Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.

Detailed Error Information:
Module DirectoryListingModule
Notification ExecuteRequestHandler
Handler StaticFile
Error Code 0x00000000
Requested URL https://localhost:44345/swagger/
Physical Path C:\LIST.MeGitCloud List\UFQI_015_SCscBlogMSAPP\
Logon Method Anonymous
Logon User Anonymous

More Information:
This error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. This setting may be disabled on purpose to secure the contents of the server.
View more information "



Net异常:The Web server is configured to not list the contents of this directory._参考资料_02


且会造成一系列连锁异常反应。

b) 应用场景

  • 使用VisualStudio的IDE,且更改过App URL的设置。
  • 使用IIS的启动方式。

二、解决方案   完成度:100%

最终RootCause为VS或IIS的BUG。删除.vs[AppName]\config\applicationhost.config文件即可。

三、声明与参考资料   完成度:100%

原创博文,未经许可请勿转载。

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
IqZfZM3LERO9
最新推荐 更多