Angular 2+应用程序IIS托管路线在重新加载时不起作用
问题描述:
我在IIS 8上托管角色2+应用程序。所有路由都是客户端路由,除了以/mutual-funds/*开头的某些路由。对于那些路由,我想让IIS获得该文件夹并使用其索引页。我已经写了重写规则,但它不能在重新加载。任何帮助,将不胜感激。Angular 2+应用程序IIS托管路线在重新加载时不起作用
的网络配置文件是:
<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="/webapp/" />
</rule>
<rule name="Check1" stopProcessing="false">
<match url="/mutual-funds/"/>
<conditions logicalGrouping="MatchAll">
<add input="{ REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/webapp/mutual-funds/" />
</rule>
答
我有兴趣,如果有人有响应。
RouterModule.forRoot(routes, {useHash: true})
它会在网址后面添加“#”:
作为一种变通方法,您可以在您提供的路由器使用哈希定位策略加入{ useHash: true }
。然后,你可以用URL http://your-context/#mutual-funds
这里访问你的网页有关位置策略GOOT文章:https://codecraft.tv/courses/angular/routing/routing-strategies/
我不想使用HashLocationStratgey。 –