2017-10-17 223 views
0

我試圖在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> 

感謝您的幫助。

回答

0

所以,問題是,當我建我的應用我需要添加--base-REF /我的網域名稱/象下面這樣:

ng build -env=dev --base-href /LPPortal2/ 

另外,我需要重寫更新到

<action type="Rewrite" url="/LPPortal2" /> 

那些兩件事情修好了我的403錯誤。

0

以管理員身份運行IDE以打開Angula文件夾,它可以工作,並且可以保存您的工作,因爲我有相同的問題並且運行Visual Studio代碼(您可以使用任何類型的最喜歡的IDE)問題。