【发布时间】:2020-08-21 15:57:29
【问题描述】:
我在带有 windows 环境的 azure 上部署了 react 应用程序。访问网站后出现以下错误 "您无权查看此目录或页面。"
我在根目录中添加了 web.config 文件,但仍然出现相同的错误。
web.config 文件代码
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
【问题讨论】:
-
尝试查看日志中发生的情况,如下所述:stackoverflow.com/questions/48853599/…
-
Tomasz Kaniewski 的建议很好,但该帖子中提到的问题是
.netweb app。我建议通过 git 部署您的 Web 应用程序,或查看日志以解决您的问题。
标签: node.js reactjs azure azure-web-app-service