【发布时间】:2018-08-28 22:30:21
【问题描述】:
我已经使用 .Net core 2.0、visual studio 2017 构建了一个 angular 4 应用程序,并部署到 IIS Web 服务器上的生产服务器。刷新时路由在本地主机上工作正常,但不能在现场工作。我在 web.config 文件中的 IIS 的 stackoverflow 中看到了一些答案。但是我的项目结构下没有 web.config 文件。我可以手动添加它还是如何修复它。
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" 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>
这是我的 app.routing 文件
const appRoutes: Routes = [
{ path: '', redirectTo: 'admin-dashboard', pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
{ path: 'forgotpassword', component: ForgotPasswordComponent },
{ path: 'user-dashboard', component: DashboardComponent, canActivate: [AuthGuard] },
{ path: 'notifications', component: NotificationsComponent, canActivate: [AuthGuard] },
{
path: 'admin-dashboard', component: AdminDashboardComponent, canActivate: [AuthGuard],
children: [
{ path: '', component: ChairmanMessagesComponent, canActivate: [AuthGuard]},
{ path: 'quotes', component: QuotesComponent, canActivate: [AuthGuard] },
{ path: 'users', component: UsersComponent, canActivate: [AuthGuard] },
{ path: 'notifications', component: AdminNotificationsComponent, canActivate: [AuthGuard] },
]
}, ];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
请告诉我。
【问题讨论】:
-
嗨..我有同样的问题..你解决了吗?