ASP.NET - Web 服务器配置为不列出此目录的内容

问题描述 投票:0回答:1

我正在尝试在服务器上部署一个网站,我尝试制作一个空白网站,但我不断收到此错误。 我查了一下,发现了很多涉及 web.config 的解决方案,但没有一个对我有用。

这是我在此处发现的进行一些更改后的 web.config:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
    <location>
        <system.webServer>
            <defaultDocument enabled="true">
                <files>
                    <add value="home.aspx"/>
                </files>
            </defaultDocument>
            <directoryBrowse enabled="false"/>
        </system.webServer>
    </location>
  <system.web>
    <compilation debug="true" targetFramework="4.7.2" />
    <httpRuntime targetFramework="4.7.2" />
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>
</configuration>

我从未将 ASP.NET 网站发布到服务器,我使用 FTP 来发布它,似乎所有文件都在服务器上。

我尝试添加

<location>

我尝试添加

<system.webServer>
    <defaultDocument>
       <files>
          <add value="insertion.aspx" />
       </files>
    </defaultDocument>
    <directoryBrowse enabled="false" />
</system.webServer>

<system.webServer>
    <directoryBrowse enabled="true" />
</system.webServer>

这是从网站仪表板拍摄的一些图片

Overview

App Pool settings

index pages

Folder settings

c# asp.net ftp web-config
1个回答
0
投票

我通过切换到不同的虚拟主机公司来修复它。

© www.soinside.com 2019 - 2024. All rights reserved.