转自:https://www.cnblogs.com/zzsdream/p/6576639.html
1.安装 url rewrite模块到IIS
2.在web.config文件中 system.webServer 节点添加如下配置(如果没有,自行添加一个Web.config)
<system.webServer> <!--rewrite 节点,用于支持history模式--> <rewrite> <rules> <rule name="API Rule" stopProcessing="true"> <match url="^(api|account|manage)(.*)$" /> <action type="None" /> </rule> <rule name="Angular Rule" 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="/" /> </rule> </rules> </rewrite> </system.webServer>