【问题标题】:After deploying the react application on azure getting error在天蓝色上部署反应应用程序后出现错误
【发布时间】: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 的建议很好,但该帖子中提到的问题是.net web app。我建议通过 git 部署您的 Web 应用程序,或查看日志以解决您的问题。

标签: node.js reactjs azure azure-web-app-service


【解决方案1】:

当遇到错误信息时,首先我们可以查看日志。具体有很多方法。您可以在 Web 应用程序的Diagnose and solve problems 中查看Application Event Logs

故障排除步骤:

  1. 首先,确认在错误消息出现之前对代码文件进行了哪些更改。这可能是异常的原因。

  2. 查看现有程序的运行日志。建议查看相关文档或blog articles学习。

  3. 如果确保以上步骤正常,建议在本地确保程序正常运行后,代码为continuously deployed through git,在Action中查看发布状态。

(因为你现在的错误信息,我大概看了一下,应该是部署失败)

【讨论】:

    猜你喜欢
    • 2017-02-13
    • 1970-01-01
    • 2018-08-16
    • 1970-01-01
    • 2015-01-08
    • 2016-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多