如何将Angular 6部署到Azure Web App-您没有权限

Tho*_*ato 3 azure angular

我已经创建了一个干净的Angular 6 App。我将以下web.config添加到src文件夹中:

<configuration>
<system.webServer>
  <rewrite>
    <rules>
      <rule name="Angular" 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>
Run Code Online (Sandbox Code Playgroud)

我在angular.json文件的资产部分中添加了“ src / web.config”。我已将Web应用程序上的节点版本更新为10.6。

当我将应用程序部署并导航到站点时,我得到以下信息:您无权查看此目录或页面。

我遵循以下示例:https : //itnext.io/easy-way-to-deploy-a-angular-5-application-to-azure-web-app-using-vsts-pipelines-4a288b9deae1

有什么建议么?

Tyl*_*lin 7

我花了很长时间才弄清楚这一点。希望对您有所帮助。

  • 在您的应用程序服务中,单击“应用程序设置”。滚动到底部。您将看到“虚拟应用程序和目录”。您的虚拟路径应为“ /”,物理路径应为“ site / wwwroot /”。将物理路径更改为“ site / wwwroot /'appname'”,“ appname”应为应用程序的名称。或者应该是“ dist”中的任何文件夹。