部署在IIS上的Angular应用程序始终返回404

时间:2019-05-31 08:58:01

标签: angular iis deployment url-rewriting

当Angular应用程序部署在IIS上时,我遇到了问题。当我尝试在浏览器中浏览应用程序时,它总是返回404错误。

我的web.config看起来像这样:

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true" />
  <handlers>
    <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
  </handlers>
  <aspNetCore processPath="dotnet" arguments=".\kv-lotsen-api.dll" forwardWindowsAuthToken="true" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
    <defaultDocument enabled="true">
        <files>
            <clear />
            <add value="index.html" />
        </files>
    </defaultDocument>
    <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>
</system.webServer>

在index.html文件中也有基本引用:

<base href="/">

有人知道我的配置中缺少什么吗?

0 个答案:

没有答案
相关问题