Web.config重写规则有时不起作用

问题描述

我已经从Angular js应用中删除了#。为此,我启用了HTML5Mode,添加了Base标记。我在Web.config中添加了重写规则。一切正常。我在主URL的子文件夹中有另一个门户。例如 demo.domain.co demo.domain.co/v1 。当我尝试重新加载 demo.domain.co/v1 demo.domain.co/v1/settings 时,它会重定向到主URL demo。 domain.co 。并非每次都在发生。它的。随机可复制。两个门户网站的基本标记如下

           <base href="/"> 
           <base href="/v1/">
           <base href="/j/">

下面是我对Web.config的所有重写规则。

           <rule name="AngularJS3" stopProcessing="true">
              <match url="/j/" />
              <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="/j/" />
            </rule>
            
            <rule name="AngularJS4" stopProcessing="true">
              <match url="(.*recoverpassword*)" />
              <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="/recoverpassword/" />
            </rule>

            <rule name="AngularJS1" stopProcessing="true">
              <match url="(.*v1*)" />
              <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="/v1/" />
            </rule>

            <rule name="AngularJS2" 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>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...