首页 文章

在Azure中托管时,Angular应用程序刷新不起作用

提问于
浏览
0

应用程序在本地工作,但是当我按下刷新时我在Azure上托管它时说“您要查找的资源已被删除,其名称已更改或暂时不可用” .

我发现了将web.config文件放在根文件中,并将其添加到angular-cli.json文件的资产中的解决方案,但是应用程序根本不起作用,它表示500内部服务器错误 .

如果有人能帮助我的话,我会感激不尽,因为我现在已经很久没有为这个问题挣扎了 .

1 回答

  • 1

    您应该将web.config移动到“ src ”文件夹而不是根目录 .

    web.config也应如下所示:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules>
            <rule name="Angular4" stopProcessing="true">
              <match url=".*" />
              <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
              </conditions>
              <action type="Rewrite" url="/" />
            </rule>
          </rules>
        </rewrite>
      </system.webServer>
    </configuration>
    

    取自这篇文章:angular 2 azure deploy refresh error : The resource you are looking for has been removed, had its name changed, or is temporarily unavailable

相关问题