#StackBounty: #angular #iis #url-rewriting #web-hosting #angular-components Site can't be reached error-After hosting Angular app o…

Bounty: 50

Recently I have hosted an angular(version 10) web app on our testing server (IIS 8.0). And also installed URL Rewrite Module in IIS also.

And following is my web.config which was added for rules.

<configuration>
<system.webServer>
  <rewrite>
    <rules>
      <rule name="Redirect all requests" 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="./index.html" />
        </rule>
    </rules>
  </rewrite>
  <directoryBrowse enabled="true" />
  <httpErrors errorMode="Custom">
      <remove statusCode="404"/>
      <error statusCode="404" path="/index.html" responseMode="ExecuteURL"/>
  </httpErrors>
</system.webServer>
<system.web>
    <customErrors mode="On" redirectMode="ResponseRewrite">
      <error statusCode="404" redirect="/index.html" />
    </customErrors>
    </system.web>
</configuration>

But after hosting the application the site is running but continuously getting following error site can’t be reached as shown in below screen shot. After getting error the URL is automatically reloading within seconds and then site is working as expected.

site can't be reached error

Following is my app pool setting.

App pool config

What is the reason for this error ? It is happening without idle time also. Am I missing any IIS setting (other apps which are published via visual studio are running fine only problem with this application) ? or need to add any other URL writing rule? or any settings need to included on my angular app? Please help me.


Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.