0

Application works in local, but when i host it on Azure whenever i press refresh it says 'The resource you are looking for has been removed, had its name changed or is temporarily unavailable.'

I found solutions like putting web.config file in root file, and adding it in assets of angular-cli.json file, but then application doesn't work at all and it says 500 internal server error.

If anybody could help me I would be grateful a lot since I've been struggling with this for a quit long time now.

manceD
  • 1
  • 1
  • 1
  • 1
    How are you hosting the page? You need to ensure that you redirect to `index.html` if the route is not found – user184994 Sep 07 '18 at 17:21

1 Answers1

3

You should move your web.config to your "src" folder instead of the root.

Also the web.config should look like:

<?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>

as taken from this post: angular 2 azure deploy refresh error : The resource you are looking for has been removed, had its name changed, or is temporarily unavailable

Mehdi Ibrahim
  • 2,434
  • 1
  • 13
  • 13
  • My bad, the web.config is in src folder, but apparently content of web.config was bad because it's working when I copy the one you posted! Thank you! – manceD Sep 07 '18 at 19:10