部署角4 IIS错误“403 - 禁止访问:访问被拒绝。”
问题描述:
我试图在IIS服务器上部署一个角4的网站,我得到这个错误部署角4 IIS错误“403 - 禁止访问:访问被拒绝。”
“403 - 禁止访问:访问被拒绝”
我的,我使用的网址是http://domain/LpPortal2/login/client和“客户端”是不是在我的角度项目的实际组成部分,它是我的登录页面要知道在页面上显示其标志和颜色。这是我的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>
感谢您的帮助。
答
所以,问题是,当我建我的应用我需要添加--base-REF /我的网域名称/象下面这样:
ng build -env=dev --base-href /LPPortal2/
另外,我需要重写更新到
<action type="Rewrite" url="/LPPortal2" />
那些两件事情修好了我的403错误。
答
以管理员身份运行IDE以打开Angula文件夹,它可以工作,并且可以保存您的工作,因为我有相同的问题并且运行Visual Studio代码(您可以使用任何类型的最喜欢的IDE)问题。