Nikson
Nikson

Reputation: 940

HTTP Error 500.19 Internal Server Error after hosting angular 4 application in IIS

I know I am not the first to ask this question here ,I could find lot of solutions related to my issue but nothing is solved my issue .,

Image :

enter image description here

Web.config

 <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="/" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

index.html

<base href ="/eCommerceWebsite/">

Physical Path in IIS

C:\eCommerceWebsite

Can anyone tell me where I did the mistakes and what I need to change here

Edit :

Image1:

enter image description here

Image 2:

enter image description here

Updated web.config

    <?xml version="1.0" encoding="UTF-8"?>
    <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="/eCommerceWebsite" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Edit 2 :

enter image description here

Upvotes: 3

Views: 11239

Answers (2)

Marcos Costa
Marcos Costa

Reputation: 490

Just to keep in register here. You need to install the IIS URL Rewrite, this is an IIS Extension to your <rewrite> routes works. This extension fixed my problem with IIS.

Upvotes: 13

Mohsin Mehmood
Mohsin Mehmood

Reputation: 4236

  1. Go to IIS Manager, select your website in left pane and check you have Url Rewrite and Authentication icons on the right

enter image description here

  1. Double click on the Authentication icon, then right click on "Anonymous Authentication" and click edit

enter image description here

  1. Select Application Pool Identity radio button enter image description here

  2. For your Application Pool set "Enable 32 bit Applications" to true

  3. Now go to C: drive right click on your website directory eCommerceWebsite and then click Security and then edit.

  4. Click Add and then in the object name you have to type in the AppPool identity user which has the format "IIS AppPool{AppPoolName}" e.g. in screenshot I have "IIS AppPool\DefaultAppPool" for defaultAppPool. Next click check names and then assign "Modify" permissions.

enter image description here

Upvotes: 3

Related Questions