ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

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

2022-02-05 23:33:42  阅读:190  来源: 互联网

标签:Web URL configured list server browsing directory


阅文时长 | 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。

详细异常如下:

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 "

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

b) 应用场景

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

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

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

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

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

如有帮助,欢迎点赞、收藏、关注。如有问题,请评论留言!如需与博主联系的,直接博客私信SCscHero即可。

标签:Web,URL,configured,list,server,browsing,directory
来源: https://www.cnblogs.com/SCscHero/p/15865062.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有