Azure 网站 404 index.html

Azure websites 404 index.html

我正在尝试 运行 我在 Azure 网站上的应用程序, 但是我的 index.html 无法正常工作。

该应用程序存在于 2 个项目中:

在我的构建定义中,我将结果从我的客户端和 Api 复制到 $(Build.ArtifactStagingDirectory) 然后我发布那个

到目前为止一切顺利,我可以在我的网站的 wwwroot 中看到来自我的客户端的文件(通过 kudu 控制台)

但是当我导航到 index.html 时,我得到一个 404。然而去 /api/... link 就像预期的那样工作

所以我认为问题是我的 web.config 覆盖了导航到 index.html 文件的可能性。

web.config

<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Portal4Fun.Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

在 .net Core 中,您需要确保您使用的是静态文件中间件,请参阅 static files documentation 了解如何添加它 - 它应该在新的 .net Core 项目中默认存在.没有这个中间件,将不会提供静态文件 - 例如。 *.css、*.js、*.html 等!