【发布时间】:2017-10-17 19:51:49
【问题描述】:
我正在尝试在 IIS 服务器上部署 Angular 4 网站,但出现此错误
“403 - 禁止访问:访问被拒绝。”
我使用的 URL 是 http://domain/LpPortal2/login/client 并且“客户端”不是我的 Angular 项目中的实际组件,它是让我的登录页面知道要在页面上显示哪些徽标和颜色。这是我的 app.routes.ts 中的代码。
const routes: Routes = [
{
path: '',
redirectTo: 'login',
pathMatch: 'full'
},
{
path: 'login/:clientCode',
component: LoginComponent
},
...
这是我的 web.config 以供您参考:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0"
type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
<handlers>
<remove name="UrlRoutingHandler"/>
</handlers>
<rewrite>
<rules>
<rule name="Angular" 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>
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
<defaultDocument>
<files>
<remove value="index.php" />
<remove value="default.aspx" />
<remove value="iisstart.htm" />
<remove value="index.htm" />
<remove value="Default.asp" />
<remove value="Default.htm" />
</files>
</defaultDocument>
</system.webServer>
感谢您的帮助。
【问题讨论】:
标签: angular iis angular-ui-router web-config webdeploy