Click here to Skip to main content
14,826,846 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I was trying to host an angular application in local IIS. It is working fine unless until use is hitting the refresh button of the browser. After hitting the refresh button it is getting an 404.0 error.

What I have tried:

After watching various sites I have added a web.config file in the folder

HTML
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="AngularJS 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="/ePortal" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>


ePortal is just the name of my application name in IIS.

After adding this I am getting 500.19 error.

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


While I am doing ng-serve it is working absolutely fine. I have also tried by adding the web.config file in assets tag in angular-cli.json. Nothing is working.

Can anybody tell me what to do?
Posted
Updated 13-Nov-20 10:25am
v2
Comments
Richard Deeming 24-May-18 15:08pm
   
Open the site in a browser running on the server. You will get a much more detailed error message, which will explain what the problem is.
Arkadeep De 24-May-18 15:37pm
   
There is nothing error is showing except 500.19 error. If so then I would search wih the error first rather than post it over here.
Richard Deeming 24-May-18 15:39pm
   
If you view the page on the server, it will show you the line of the config file that's causing the problem, and the details of the problem.

Without those extra details, it's anyone's guess what the problem might be.
Arkadeep De 24-May-18 15:42pm
   
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x8007000d
Config Error
Config File \\?\C:\d\Arka\Angular\Projects\p\web.config
Requested URL http://localhost:81/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined

Config Source:
-1:
0:


this is the total error message I am getting after putting the web.config. Without web.config site is running, but refresh is not working.
Richard Deeming 24-May-18 15:43pm
   
And there's the missing part of the error. :)
Bryian Tan 24-May-18 15:27pm
   
not clear what magic files in the ePortal folder, my guess is, the app can't find the landing page or don't know which magic file in the folder is the landing page.
Arkadeep De 24-May-18 15:35pm
   
there are no magic files are in the ePortal folder. It is just the prod build files of a simple angular app having 2 components.. everything is working fine unless until I am refreshing the prod build hosted site.
Bryian Tan 24-May-18 15:38pm
   

Error 0x8007000d means URL rewriting module (referenced in web.config) is missing or proper version is not installed.

You need to install the URL Rewriting module:
URL Rewrite : The Official Microsoft IIS Site[^]
   
Comments
Arkadeep De 5-Jun-18 3:30am
   
Thanks, this is a real solution.. (y)
Good, solution, it works. Thanks.
   
Comments
CHill60 14-Nov-20 7:32am
   
If you want to comment on a solution usar the "Have a Question or Comment" link next to it. This is not a solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900