Приложение Angular не работает на IIS - PullRequest
1 голос
/ 25 апреля 2019

Я пытаюсь опубликовать свое приложение на IIS, но когда я пытаюсь обновить, я получаю

Ошибка

The Web server is configured to not list the contents of this directory..

Путь приложения

 E:\tutorial\Angular Login\front\clientapi

Угловая сборка

ng build --prod --base-href=/eclipse/

После сборки приложения я получаю следующий вывод в папку dist

enter image description here

Я копирую папку clientapi и вставляю ее в папку C: \ ecilpse

enter image description here

Затем опубликуйте на IIS enter image description here

После этого я добавлю файл web.config в eclipse папка

<configuration>

<system.webServer>

  <rewrite>

    <rules>

      <rule name="Angular Routes" 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="/eclipse/" />

        <!--<action type="Rewrite" url="/" />-->

      </rule>

    </rules>

  </rewrite>

</system.webServer>

</configuration>

1 Ответ

0 голосов
/ 25 апреля 2019

Проблема устранена с помощью следующих шагов.

  1. Копировать все файлы из dist\clientapi
  2. Вставить в c:\eciplse
  3. Обновить файл Web.config с помощью <action type="Rewrite" url="./index.html" />
...