2017-08-08 68 views
0

我想主辦IIS 10我的角4應用程序,它的正常工作時 重定向到一個路徑到另一個通過點擊應用程序內的任何鏈接,但是當我鍵入URL相同的鏈接它我得到404錯誤信息。角4/2應用託管在IIS

我已經通過角文件消失了,它說,我個人有T創建退回到index.html的,我做到了使用URL重新寫在IIS級別,也沒有工作。

我的託管應用程序URL是http://localhost:86/

這裏是被添加作爲網站在IIS中我的應用程序文件夾的結構: enter image description here

基本href是<base href="/">

有什麼不對?

一件事,它是通過使用這個後備的用戶將無法鍵入URL時,它會重新定向到的index.html?

+0

你可以嘗試與基礎href =「./」? –

+0

嘗試在webconfig deault頁面設置index.html –

+0

它沒有工作? –

回答

0

以下是託管應用程序的webconfig中需要完成的操作。

<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> 

只需將其替換爲web配置的內容並考慮操作標記url。我的基地網址是「/」。

謝謝