我在本地PC上的IIS(inetmgr)上创建了一个虚拟目录,然后将其转换为IIS Web应用程序。 Web应用程序的根目录是:http://localhost/xyz/部署并运行应用程序时,我在浏览器中收到以下错误:
找不到所有html组件404错误。
在web.config中添加了重写规则。我将index.html的基本href更改为./xyz或./但没有运气。
如果我将它部署到根目录,一切都会解决 - 不确定出了什么问题。
答案 0 :(得分:1)
xyz
文件夹作为Web应用程序文件夹(见下图)
<base href="/spa/">
<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" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
希望它有所帮助!