我已将Angular 4项目升级到Angular6。它已在本地成功运行。部署到systest后,当我访问home url时,它引发了以下错误:
以下是我的路线:
const appRoutes: Routes = [
// otherwise redirect to home
{ path: '', redirectTo: '/Home', pathMatch: 'full' },
{ path: 'Home', component: HomeComponent },
{ path: 'Login', component: LoginComponent },
{ path: 'Logout', component: LogoutComponent },
];
我通过以下命令创建了构建:
ng build --prod --base-href /<projectname>/<projectname>.UI/
以下是我的配置文件:
<configuration>
<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="/index.html" />
</rule>
</rules>
</rewrite>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
<caching>
</caching>
<urlCompression doStaticCompression="true"/>
</system.webServer>
</configuration>
我想念什么?