2016-09-09 77 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>