2

I have a problem when deploying my Angular app on IIS, I added the config file "web.config", and granted the permissions to the users:

<?xml version = "1.0" encoding = "UTF-8" ?>
<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="/" />
          </rule>
        </rules>
      </rewrite>
    </system.webServer>
</configuration>

but I keep getting this error: enter image description here

If I remove the web.config file it works but not completely, I still get the 404 error in the Api calls and when I reload the page.

Edited here:

Additional information:

here is the bad 404 error that I get when removing we.config:

enter image description here

enter image description here

this is the app.config.json:

{
  "apiUrl": "my_back_end_deplyment_Url",
  "dashboardUrl": "/",
  "theme": "theme-green",
  "notificationRefreshInterval": 900000,
  "maxNotificationToTake": 10,
  "useNotifications": false,
  "useDashboard": false,
  "intervalConnectionCheck": 300000
}

Am I messing something else (maybe to link the angular app to my .NET Core app) ?

hghandi
  • 104
  • 1
  • 9
  • Can you change the rewrite url to /index.html? – MikeOne Aug 27 '21 at 09:51
  • I already did that but it didn't work – hghandi Aug 27 '21 at 10:03
  • 1
    Does this answer your question? [HTTP Error 500.19 Internal Server Error after hosting angular 4 application in IIS](https://stackoverflow.com/questions/50596708/http-error-500-19-internal-server-error-after-hosting-angular-4-application-in-i) – Lex Li Aug 27 '21 at 16:45
  • @LexLi no it doesn't, actually I used that link to configure all the rest, I already answered my question but I can't approve it until 2 days after I posted it, and I just did so ... . Here is its link if I ever forgot to approve it: https://stackoverflow.com/a/68955166/12134299 – hghandi Aug 27 '21 at 17:38

1 Answers1

2

It appears that UrlReWrite is necessary for this process, I couldn't install it in the beginning because of restrictions put by the company (security issues). After it was installed it worked just fine.

hghandi
  • 104
  • 1
  • 9