0

I have created a Virtual Directory on IIS (inetmgr) on my local PC and later converted it into IIS Web Application. The web application's root is: http://localhost/xyz/ When deployed and ran the application, I get the following error in the browser:

All html components 404 not found errors.

Added rewrite rules in web.config. I changed index.html's base href to ./xyz or ./ but no luck.

If I deploy it to root directory, everything resolves - not sure what's going wrong.

1 Answer 1

1

1. Enable xyz folder as a web application folder (See below picture)

2. Update base href, for example <base href="/spa/">

3. Set rewrite rule

<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" />
        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
      </conditions>
      <action type="Rewrite" url="/" />
    </rule>
  </rules>

Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.