【发布时间】:2021-08-27 09:34:12
【问题描述】:
在 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 应用程序)?
【问题讨论】:
-
你能把rewrite url改成/index.html吗?
-
我已经这样做了,但是没有用
-
@LexLi 不,它没有,实际上我使用该链接来配置所有其余部分,我已经回答了我的问题,但直到发布后 2 天我才能批准它,我只是这样做了……如果我忘记批准它,这里是它的链接:stackoverflow.com/a/68955166/12134299
标签: angular iis deployment web-deployment http-status-code-500