I have a ASP.NET CORE app that uses angular2 routing. Running local routes resolve as expected. When I publish to the server (running IIS 7) the routes appear to resolve to the server root and not the website they are deployed to, however, they still render the page. In the example below the "page url" is the page I navigate to but the "result url" is what is displayed in the browser address bar.
page url --> http://myserver/myapp/home
result url --> http://myserver/home
Any ideas on why this is happening? Is this an IIS setting, or Angular routing issue or a .NET CORE config issue?
Here is the way I have my routes configured in angular2.
const routes: ClientRouterConfig = [
{ displayName: 'Dashboard', icon: 'fa fa-tachometer', path: '', redirectTo: 'home', pathMatch: 'full' },
{ showInNavigationMenu: true, displayName: 'Dashboard', icon: 'fa fa-tachometer', path: 'home', component: HomeComponent },
{ showInNavigationMenu: true, displayName: 'New Work Order', icon: 'fa fa-plus', path: 'workorder', component: WorkorderComponent },
{ showInNavigationMenu: false, displayName: 'Work Order', icon: 'fa fa-wrench', path: 'workorder/:id', component: WorkorderComponent },
{ showInNavigationMenu: false, displayName: 'New Task', icon: 'fa fa-user', path: 'task/create/:woid', component: TaskComponent },
{ showInNavigationMenu: false, displayName: 'Task', icon: 'fa fa-user', path: 'task/:id', component: TaskComponent },
{ displayName: 'Dashboard', icon: 'fa fa-tachometer', path: '**', redirectTo: 'home' } //this must be last
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {
getRoutes() {
return routes;
}
}