在asp.net核心应用程序中设置Angular 2 main.js文件路径的位置

在asp.net核心应用程序中设置Angular 2 main.js文件路径的位置,angular,asp.net-core,Angular,Asp.net Core,我有一个普通的wwwroot/app/main.js文件,并在index.cshtml中使用选择器,这是默认的,可以在视图/Home中找到。main.js位于localhost:5000/app/main.js下,但只要我在同一Views/Home路径下的另一个.cshtml文件中使用选择器,我就会收到一个404错误,我看到应用程序正在localhost:5000/Home/app/main.js下查找main.js。显然是在错误的路径中查找文件 我试着换衣服 <script>

我有一个普通的
wwwroot/app/main.js
文件,并在
index.cshtml
中使用选择器
,这是默认的,可以在
视图/Home
中找到。main.js位于
localhost:5000/app/main.js
下,但只要我在同一
Views/Home
路径下的另一个
.cshtml
文件中使用选择器,我就会收到一个404错误,我看到应用程序正在
localhost:5000/Home/app/main.js
下查找main.js。显然是在错误的路径中查找文件

我试着换衣服

<script>
  System.import('app').catch(function(err){ console.error(err); });
</script>

System.import('app').catch(函数(err){console.error(err);});

它位于
\u Layout.cshtml
中,提供了main.js的完整路径,但不起作用

检查此链接您当前如何设置路径?@Shyju如果
System.import('app')
是您设置路径的方式,则它是默认的
app
。我试过像
app/main
wwwroot/app/main
这样的想法,但是没有用。@rashfmnb我能看到的唯一相关的是用来设置路径的
app/boot
。你在
\u Layout.cshtml
中添加了