Angular 在 HTTPS 上 运行 时无法匹配任何路由

Angular Cannot match any routes when running on HTTPS

我有一个由 Radzen IDE 运行 在 IIS 上生成的 Angular 应用程序。在应用程序中有一个指向用于下载文件的 .Net API 的锚标记。该锚点的 href 如下所示:

https://[AngularApp.mydomain.com]/api/ServerMethods/DownloadFile?fName=[NameOfTheFile.pdf]&ID=[SomeID]

当应用程序在 http 上运行并且我单击 link 时,下载按预期进行。当应用程序在 https 上运行时,我收到“无法匹配任何路由”错误:

ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL 
Segment: 'api/ServerMethods/DownloadFile'
Error: Cannot match any routes. URL Segment: 
'api/ServerMethods/DownloadFile'

当我使用 Postman 直接调用 API 时,即使使用 https,下载也能正常进行。当我右键单击下载 link 并单击“另存为 link 时,它也适用于 https。只有当我尝试从 Angular 应用程序中打开 link 时,或者当我直接在浏览器中打开 link 时,才会出现此错误。

我需要在 IIS 中配置什么吗?我在 .Net CLR 版本或托管管道模式的应用程序池上尝试了不同的设置,但没有效果。

您应该使用 <a href="your/url" 而不是 <a routerLink="your/url",因为您在此处导航到 angular 应用程序

之外