【发布时间】:2019-11-04 11:25:27
【问题描述】:
我在 IIS 7 上托管了一个 Angular 7 应用程序,应该可以通过 https://example.com/fitcbooks/web 访问它。这工作,然后突然停止 - 因为我似乎无法理解的原因。服务器上的 URL 重写似乎正在工作(用于重定向同一服务器上的其他站点),但它只是针对这个特定的应用程序而崩溃。
我已经为 IIS7 安装了 URL 重写模块 2。我还使用 --base-ref 构建了 Angular 应用程序,并且已经使用了 web.config 代码,如下所示。我还构建了该应用程序的本地版本,它在我运行 AMPPS 的 macbook 上完美运行,消除了应用程序本身的任何问题。这看起来像是服务器问题。
web.config:
<configuration>
<system.webServer>
<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" />
</conditions>
<action type="Rewrite" url="/fitcbooks/web/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
index.html:
<base href="/fitcbooks/web/">
目前,应用的预加载器只是永久加载。控制台显示几个 500 (URL Rewrite Module Error.) 错误。请帮忙。
【问题讨论】:
-
使用 Fiddler 之类的工具来抓取完整的 500 错误页面,然后查看它的内容。
-
感谢@LexLi 的提示。我安装了 Fiddler,但并没有真正开始阅读 HTTPS 500 详细信息。最终使用 IIS 的失败请求跟踪规则来设置日志,我后来检查了。您的评论帮助我指出了这个方向。
标签: angular windows macos iis url-rewriting