3

I have angular2 app. After publish it on IIS when I refresh browser I'm getting 404 error.

As I found here I add web.config file in my dist folder (where I have published my app)

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

and here is my folder

enter image description here

But now after refresh I'm getting

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.

What's wrong?

(I know about HashLocationStrategy and I don't want to use that)

gsiradze
  • 4,583
  • 15
  • 64
  • 111

0 Answers0