【发布时间】:2019-10-03 06:11:39
【问题描述】:
MVC项目根目录下有一个Startup.cs。
我启用了目录浏览。但是在运行项目时显示以下屏幕。我希望在 MVC 项目中,不需要设置默认页面。我也尝试在默认文档(IIS)中添加 Startup.cs,但它会引发扩展被拒绝错误。尝试在 ApplicationHost.config 文件中添加 .cs 扩展名。但它会给出更复杂的错误。
Web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument enabled="true" />
<directoryBrowse showFlags="Date, Time, Size, Extension, LongDate" />
</system.webServer>
</configuration>
【问题讨论】:
-
我最近收到了这个。在我的情况下,在 url 之后添加文件名。例如:localhost:4351 到 localhost:4351/index.aspx。你有很多页面,所以在 url 之后写下你的“起始页”
-
当我尝试localhost:49592/Startup.cs时,它显示请求过滤模块被配置为拒绝文件扩展名。
标签: c# asp.net asp.net-mvc asp.net-mvc-4