2017-03-01 4 views
0

저는 최근에 vs2015 및 IIS 7.5에서 앵귤러 2 프로젝트를 언급했습니다. 페이지 새로 고침시 페이지를 새로 고치는 데 문제가 있습니다.각도 2 + 새로 고침 404 오류 IIS

"HTTP 오류 404.0 - 찾을 수 없음".

import { NgModule } from '@angular/core'; 

import { RouterModule } from '@angular/router'; 

import { CodesComponent } from '../components/codes/codes.component'; 

@NgModule({ 
    declarations: 
    [ 
     CodesComponent 
    ], 
    imports: 
    [ 
     RouterModule.forChild([ 
      { path: 'codes', component: CodesComponent }, 
     ]) 
    ] 
}) 
export class CodesModule { 

} 

import { NgModule } from '@angular/core'; 

import { RouterModule } from '@angular/router'; 

import { AdminCompoment } from '../components/admin/admin.component'; 

@NgModule({ 
    declarations: 
    [ 
     AdminCompoment 
    ], 
    imports: 
    [ 
     RouterModule.forChild([ 
      { path: 'admin', component: AdminCompoment }, 
     ]) 
    ] 
}) 
export class AdminModule { 

} 
: 나는 app.module.ts

import { NgModule }  from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 

import { HttpModule } from '@angular/http'; 
import { RouterModule } from '@angular/router'; 

import { AppComponent } from './app.component'; 
import { HomeComponent } from './components/home/home.component'; 

import { HomeModule } from './modules/home.module'; 
import { CodesModule } from './modules/codes.module'; 
import { AdminModule } from './modules/admin.module'; 

@NgModule({ 
    imports: 
    [ 
     BrowserModule, 
     HttpModule, 
     RouterModule.forRoot([ 
      { path: 'home', component: HomeComponent }, 
      { path: 'home/:unauthorized', component: HomeComponent }, 
      { path: '', redirectTo: 'home', pathMatch: 'full' }, 
      { path: '**', redirectTo: 'home', pathMatch: 'full' }, 
     ]), 
     HomeModule, 
     CodesModule, 
     AdminModule 
    ], 
    declarations: 
    [ 
     AppComponent, 
     HomeComponent 
    ], 
    bootstrap: [ AppComponent ] 
}) 
export class AppModule { } 

그리고 다른 moduls에서

<script>document.write('<base href="' + document.location + '" />');</script> 

이 된 index.html에서 :

그리고 여기 내 각 코드

해시 태그를 사용해도 올바르게 작동하지만 t를 원하지 않습니다. 태그에는 use 태그가 있습니다. IIS에서 규칙을 다시 작성하려고했지만 일부 페이지를 새로 고칠 때 기본 페이지로만 리디렉션됩니다.

제발 도와주세요. 감사합니다. .

답변

1

해결되었습니다. 단계 :

  1. 는 Index.html을 추가하려면이 <action type="Rewrite" url="/eUsluge.Administration.UI/" appendQueryString="true" />

  2. 같은 조치를 Web.config의 에 재 추가이

<base href="/Application/" />

+0

안녕하세요, web.config에서 이것이 추가 될 예정입니까? 여기 – prestonsmith

+0

<규칙 이름 = "AngularJS와"stopProcessing = "진정한"> <매치 URL = "^ (. *) $"하여 ignoreCase = "거짓"/> <조건 logicalGrouping = "MatchAll"> <액션 타입 ="/> ""URL = "여기"appendQueryString = "true를 다시 쓰기 – user3118955

+0

'eUsluge.Administration.UI'값은 무엇이고 어디서 오는 것입니까? – Neutrino