【发布时间】:2020-10-28 03:55:52
【问题描述】:
我将我的 dot net core 3.1 api 和 angular 9 应用程序部署到 IIS 中。 Api 运行良好。当我点击登录网址时,它运行良好并将我带入我的仪表板。 http://192.168.15.12:8020/ePortal/home.
之后,当我点击我的其他组件时说我想去颜色。当我点击颜色时,网址是 http://192.168.15.12:8020/home/color-details 而不是 http://192.168.15.12:8020/ePortal/home/color-details 这就是它显示 404(未找到)错误的原因。
我已经使用ng build --prod --base-href /ePortal/ 构建了产品,还添加了一个 web.config 来重写 url
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<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="/ePortal/" />
<!--<action type="Rewrite" url="/" /> /ePortal/-->
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
我无法确定问题所在。请帮忙
【问题讨论】:
标签: angular angular-material angular-ui-router