【发布时间】:2019-04-10 15:22:03
【问题描述】:
我有一个由 ASP.NET Boilerplate 创建的 Angular 模板。我已经成功发布了它,它在一个网站下的 IIS 上运行顺利。但是,我的客户希望让它在虚拟目录下运行,而不是在自己的网站下运行。
我已将 appconfig.json 更新如下:
{
"remoteServiceBaseUrl": "http://localhost:8080/Training",
"appBaseUrl": "http://localhost:8080/Training"
}
并在 appSettings.json 中对 App 执行相同操作:
"App": {
"ServerRootAddress": "http://localhost:8080/Training/",
"ClientRootAddress": "http://localhost:8080/Training/",
"CorsOrigins": "http://localhost:8080/Training"
}
由于某种原因,当我运行该应用程序时,我收到以下错误,它无法加载某些 CSS 和 JavaScript 包:
我手动更改了 wwwroot 文件夹中的 index.html 并将http://localhost:8080/Training/ 添加到每个 href 的开头。通过这样做,所有这些错误都消失了,现在我留下了这个错误:
GET http://localhost:8080/assets/appconfig.json 404 (Not Found)
我认为这与 AppPreBootstrap.ts 文件有关,它从 appconfig.json 文件中读取。
在发布应用程序之前,我是否必须在某处对应用程序设置进行任何更改才能消除上述问题?
【问题讨论】:
标签: javascript iis aspnetboilerplate virtual-directory base-url