2016-06-16 6 views
2

ソースコードでいくつかのことを学びたいと思いますが、このコードを自分自身で複製しようとすると、リソースの読み込みに失敗しました:サーバーが403の状態で応答しました(禁止されています)MVC 5

私はビューインデックスを持っています。別のフォルダからいくつかの.cshtmlテンプレートにアクセスしようとしています。

@{ 
    ViewBag.Title = "Index"; 
} 
<div ng-controller="inboxIndexCtrl"> 
    <div class="row"> 
     <div class="col-sm-1"> 
      <a ng-href="#/" id="InboxSubNav">Inbox</a> 
      <hr /> 
      <a ng-href="#/sent" id="InboxSubNav">Sent</a> 
      <hr /> 
      <a ng-href="#/create" id="InboxSubNav">Create</a> 
     </div> 
     <div class="col-sm-11"> 

      <div class="well" ng-view></div> 

     </div> 

    </div> 
</div> 

スクリプト:

var mail = angular.module('mail', ['ngRoute']); 

mail.config([ 
    '$routeProvider', ($routeProvider) => { 
     $routeProvider.when('/', { 
      templateUrl: 'Templates/Incoming.cshtml' 
     }) 
      // Registering path with controller relative to Inbox/Index 
      // This part is similar to RouteConfig.cs in ASP MVC 
      .when('/message/:id', { 
       // Templates are located inside Inbox. 
       templateUrl: 'Templates/Message.cshtml', 
       controller: 'oneMessageCtrl' 
      }).when('/create', { 
       templateUrl: 'Templates/Create.cshtml', 
       controller: 'createCtrl' 
      }).when('/reply/:id', { 
       templateUrl: 'Templates/Reply.cshtml', 
       controller: 'replyCtrl' 
      }).when('/sent', { 
       templateUrl: 'Templates/Sent.cshtml', 
       controller: 'sentCtrl' 
      }) 

      .otherwise({ redirectTo: '/' }); 

    } 
]); 

_layoutはNG-アプリ<html ng-app="mail">が含まれています。またAngularバンドルはJqueryの前にロードされ、これはlocalhostで行われます。私が使用しています

バージョン:

Angular 1.3.0-beta4 
jquery-1.10.2 

ページの負荷は、第二のためにそれが<div class="well" ng-view></div>、その後消えるをロードし

リンクの上にマウスを置くと、パスが正常であるようです。リンクをクリックするとパスに入りますが、403エラーのために何もロードされません。ここで

いくつかのリンク:

http://localhost:49602/Messages/Index#/ 
http://localhost:49602/Messages/Index#/sent 
http://localhost:49602/Messages/Index#/create 

私の推測では、私は角/ jqueryのの右バージョンを使用していないか、私はいくつかのパッケージが不足していますということですか?私は、問題解決のstackoverflowからの助けを借りて、まあ

Server Error in '/' Application. This type of page is not served.

Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.

Requested URL: /Messages/Templates/Create.cshtml

+1

お試しください >> http:// localhost:49602/Messages /#/ >> http:// localhost:49602/Messages /#/ を送信します。http:// localhost:49602/Messages /#/ –

+0

を作成します。 'HTTPエラー403.14 - 禁止されました Webサーバはこのディレクトリの内容をリストしないように設定されています。 ' – Eduard

+0

また、この' < /system.webServer> ' – Eduard

答えて

4

がブラウザで1つのテンプレートを表示しようとした別のエラーを得たServer Error in '/' Application. This type of page is not served

<add key="webpages:Enabled" value="true" /> 
:ここ

をソリューションであります

私のwebconfigでfalseに設定されました

+0

このエラーが発生しました:'リソースの読み込みに失敗しました:サーバがステータス500(内部サーバエラー)で応答しました。 – Si8

関連する問題