我在 IIS 上部署 Angular 应用程序时遇到问题,我添加了配置文件“web.config”,并向用户授予了权限:
<?xml version = "1.0" encoding = "UTF-8" ?>
<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="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
如果我删除 web.config 文件,它可以工作但不完全,我仍然会在 Api 调用和重新加载页面时收到 404 错误。
此处编辑:
其他信息:
这是我在删除 we.config 时遇到的严重 404 错误:
这是app.config.json:
{
"apiUrl": "my_back_end_deplyment_Url",
"dashboardUrl": "/",
"theme": "theme-green",
"notificationRefreshInterval": 900000,
"maxNotificationToTake": 10,
"useNotifications": false,
"useDashboard": false,
"intervalConnectionCheck": 300000
}
我是否搞乱了其他东西(也许是将 Angular 应用程序链接到我的 .NET Core 应用程序)?
最佳答案
看起来 UrlReWrite对于这个过程是必要的,由于公司的限制(安全问题),我一开始无法安装它。安装后就可以正常使用了。
关于angular - 错误 HTTP 500.19 - 在 IIS 中部署 Angular 应用程序时出现内部服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68951170/