angular4,typescript,MVC5-HTML模板文件获取404错误

时间:2019-01-02 14:24:02

标签: angular typescript

我的组件在/app/Component/文件夹中,而HTML文件在/app/HTML/文件夹中。我的组件声明如下

@Component({
    selector: 'app-header',
    templateUrl: '/app/HTML/header.html'

})

从Visual Studio运行时,它在本地运行良好。但是,在IIS中托管虚拟目录之后,它通过从路径中省略虚拟目录并获得404错误来采用不同的路径。

很抱歉粘贴此冗长的错误

(index):31 http://localhost/VirtualDirectory/
zone.js:2969 GET http://localhost/app/app.component.html 404 (Not Found)
scheduleTask @ zone.js:2969
ZoneDelegate.scheduleTask @ zone.js:407
Zone.scheduleTask @ zone.js:232
Zone.scheduleMacroTask @ zone.js:255
scheduleMacroTaskWithCurrentZone @ zone.js:1114
(anonymous) @ zone.js:3001
proto.(anonymous function) @ zone.js:1394
ResourceLoaderImpl.get @ resource_loader_impl.ts:57
DirectiveNormalizer._fetch @ compiler.es5.js:14083
DirectiveNormalizer.normalizeTemplateOnly @ compiler.es5.js:14129
DirectiveNormalizer.normalizeTemplate @ compiler.es5.js:14111
CompileMetadataResolver.loadDirectiveMetadata @ compiler.es5.js:15144
(anonymous) @ compiler.es5.js:26838
(anonymous) @ compiler.es5.js:26837
JitCompiler._loadModules @ compiler.es5.js:26834
JitCompiler._compileModuleAndComponents @ compiler.es5.js:26803
JitCompiler.compileModuleAsync @ compiler.es5.js:26729
PlatformRef_._bootstrapModuleWithZone @ application_ref.ts:333
PlatformRef_.bootstrapModule @ application_ref.ts:371
(anonymous) @ main.ts:9
(anonymous) @ main.ts:9
(anonymous) @ main.ts:9
evaluate @ evaluate.js:106
(anonymous) @ instantiate.js:359
dynamicExecute @ register-loader.js:665
doEvaluate @ register-loader.js:612
ensureEvaluate @ register-loader.js:520
(anonymous) @ register-loader.js:133
ZoneDelegate.invoke @ zone.js:388
Zone.run @ zone.js:138
(anonymous) @ zone.js:872
ZoneDelegate.invokeTask @ zone.js:421
Zone.runTask @ zone.js:188
drainMicroTaskQueue @ zone.js:595
Promise.then (async)
scheduleMicroTask @ zone.js:578
ZoneDelegate.scheduleTask @ zone.js:410
Zone.scheduleTask @ zone.js:232
Zone.scheduleMicroTask @ zone.js:252
scheduleResolveOrReject @ zone.js:862
resolvePromise @ zone.js:808
(anonymous) @ zone.js:724
Promise.then (async)
(anonymous) @ zone.js:1042
ZoneAwarePromise @ zone.js:891
Ctor.then @ zone.js:1041
resolvePromise @ zone.js:775
(anonymous) @ zone.js:873
ZoneDelegate.invokeTask @ zone.js:421
Zone.runTask @ zone.js:188
drainMicroTaskQueue @ zone.js:595

0 个答案:

没有答案