我有一个组件的简单应用程序,它需要来自url的某些参数。只有一个在申请途径:Angular 2托管在IIS上:HTTP错误404
const appRoutes: Routes =
path: 'hero/:userId/:languageId',component: HeroWidgetComponent }];
在中的index.html,我有这样的标题<base href="/">
我使用的WebPack和运行应用程序的开发环境不错,浏览网址时:http://localhost:4000/hero/1/1
。
但是,在构建生产应用程序并获取分发文件时,然后将其托管在IIS上。
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
应用程序工作正常,如果我删除所有的路由,只是浏览:http:localhost:4200
上的IIS尝试浏览时相同的URL我收到以下错误。
你'IIS'服务器需要让所有的角路由重定向到'index.html'正确配置(或HTML文件,其中角应用被触发)。不幸的是,我不是'IIS'服务器专家,所以我不能给你一个真正的答案如何做到这一点。 – tftd