IIS错误404偶文件存在,aspx正常打开

IIS error 404 even file existsn, aspx opens normally

我无法访问 html 页面或任何图像文件,只有我能够访问成功的 .apsx asmx 和 ashx 文件。我收到 404 - 找不到文件或目录

例如:

mysite.com/index.html  ( getting 404 error)
mysite.com/image.jpg( getting 404 error)

mysite.com/page.aspx (working fine)
mysite.com/service.asmx/method  ( working fine)

我尝试过的事情:

  1. 正在检查 IUSR 和 IIS_IUSRS 的文件夹权限。
  2. MIME 类型
  3. 映射处理程序

我将 post 我的 web.config 设置。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="50000000" />
      </webServices>
    </scripting>
  </system.web.extensions>
  <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" />
    <authentication mode="None" />
    <webServices>
      <protocols>
        <add name="HttpGet" />
        <add name="HttpPost" />
      </protocols>
    </webServices>
  </system.web>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
      </customHeaders>
    </httpProtocol>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <handlers>
      <remove name="ScriptHandlerFactory" />
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="PHP5" path="*.php" verb="*" modules="CgiModule" scriptProcessor="C:\******\php-cgi.exe" resourceType="Unspecified" requireAccess="Script" />
      <add name="uploadfile" path="uploadfile.ashx" verb="*" type="Namespace.uploadfile" />
    </handlers>
  </system.webServer>
  <connectionStrings>
    <add name="SalikConnection" connectionString="Data Source=**************;Initial Catalog=*****;uid=*****;password=****************;" providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>

有什么建议吗?

编辑并解决

将静态内容添加到 web.config

 <system.webServer>
        <handlers>
           <clear />
            <add 
                name="StaticFile" 
                path="*" verb="*" 
                modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" 
                resourceType="Either" 
                requireAccess="Read" />
        </handlers>
        <staticContent>
            <mimeMap fileExtension=".*" mimeType="application/octet-stream" />
        </staticContent>

请确保在 Windows 功能对话框的 IIS 下选中静态内容复选框。查看截图

Static Content