2016-09-09 78 views
1

我的index.html来自MVC应用程序的文件包含以下代码。所有文件都被加载到浏览器中,但没有来自Views文件夹的文件被加载。 Index.html文件,脚本&视图文件夹位于根位置。java脚本文件404(未找到)

<body> 
    <div ng-view></div> 

     <script src="Scripts/jquery-1.9.1.min.js"></script> 
     <script src="Scripts/angular.min.js"></script> 
     <script src="Scripts/angular-route.min.js"></script> 
     <script src="Scripts/app.js"></script> 
     <script src="Views/Authentication/Services.js"></script> -- Error here 
     <script src="Views/Authentication/AuthenticationController.js"></script> -- Error here 

    </body> 

文件夹结构

enter image description here

我得到以下错误消息时,我从铬devtool检查它。

http://localhost:58348/Views/Authentication/AuthenticationController.js 404(未找到)

即使我添加js/html处理成的web.config,但仍然面临着同样的问题。

<add name="JavaScriptHandler" path="*.js" verb="*" preCondition="integratedMode" 
      type="System.Web.StaticFileHandler" /> 

      <add name="HtmlScriptHandler" path="*.html" verb="*" preCondition="integratedMode" 
       type="System.Web.StaticFileHandler" /> 
+0

我认为这是与路径的问题。 '脚本/ Vies ...'也许? – yhabib

+0

是您的脚本在视图文件夹或脚本文件夹? – MPavlak

+0

Index.html文件,脚本和视图文件夹位于根目录位置。 –

回答

0

的视图可能无法访问该脚本文件,由于不正确的路径。

尝试,

<script src="~/Views/Authentication/AuthenticationController.js"></script>