2
votes

URL routing is working fine but when i create application in IIS website, application stop working with error

HTTP Error 500.52 - URL Rewrite Module

This rule is working fine (http://abcd/)

<rule name="AngularJS Routes" stopProcessing="false">
          <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>

But when i change it application it gives error (http://abcd/app/)

<rule name="AngularJS Routes" stopProcessing="false">
          <match url="(^app/.*)" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />

          </conditions>
          <action type="Rewrite" url="/app/"/>
        </rule>

Error Image

I have searched on google but found no solution. Expert guides is need.Thanks

1

1 Answers

1
votes

Your config error says:

Cannot add duplicate collection entry of type 'rule' with unique key attribute 'name' set to 'AngularJS Routes'

You'll probably need to change one of your rule name to make it work, for example:

<rule name="AngularJS Routes" stopProcessing="false">[...]</rule>
<rule name="AngularJS App Routes" stopProcessing="false">[...]</rule>