我们有一个带有IIS网站和下面的IIS Web应用程序的Web服务器. Web应用程序的根目录是:
http://website/webapplication/.
部署后,我在浏览器中收到以下错误:
部署后,我在浏览器中收到以下错误:
07001 404 (Not Found)
app/app.component.html 404 (Not Found)
我的组件:
@Component({ selector: "app",templateUrl: "./app/app.component.html" })
文件app.component.html确实不存在于/app/app.component.html下,但确实存在于:/webapplication/app/app.component.html.
所以,我的结论是Angular仅在网站的根目录中有效.
在html标题中,我将标记设置为:< base href =“/ webapplication /”>,但这没有帮助.
这似乎是一个正常的设置,我无法相信在Angular中解析的模板失败,我必须遗漏一些东西……有谁知道解决这个问题?
解决方法
虽然您可以使用Url Rewrite并使其正常工作,但此问题的唯一长期解决方案是使用HashLocationStrategy.