我正在尝试将Angular应用程序部署到Azure Web应用程序,但是深层链接不起作用。
angular.json:
os.walk
我在src文件夹中添加了一个web.config:
"assets": [
"src/favicon.ico",
"src/assets",
"src/coreui",
"src/web.config"
我的路线:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
<remove fileExtension=".woff"/>
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
</staticContent>
<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>
</configuration>
index.html:
const routes: Routes = [
{path:'', component: DashboardComponent,canActivate: [AuthenticationGuard]},
{path:'login', component: LoginComponent},
{path:'logout', component: LogoutComponent},
{path:'reports',component: ReportsComponent,canActivate: [AuthenticationGuard]},
{path:'dashboard',component: DashboardComponent,canActivate: [AuthenticationGuard]},
{path:'assets/:id',component: AssetsComponent,canActivate: [AuthenticationGuard]}
];
还有更多设置要设置吗?注意,该应用程序已部署了一个asp.net core 2.1 api项目。我不知道这种应用程序是否会与appsettings.json冲突或应该仍然有效?