2017-08-08 63 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。我的基地网址是“/”。

谢谢