我想用源代码学习一些东西,但是当我尝试复制自己这段代码时,我得到了该错误。加载资源失败:服务器响应状态为403(禁止)MVC 5
我有一个视图索引其中我试图从另一个文件夹访问一些.cshtml模板。
@{
ViewBag.Title = "Index";
}
脚本:
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-应用。另外Angular bundle在Jquery之前加载,并且这是通过localhost完成的。
版本我使用:
Angular 1.3.0-beta4
jquery-1.10.2
页面加载时,为第二它加载
当我将鼠标悬停在链接上方时,路径似乎很好。当我点击链接时,它将继续路径,但由于403错误而不会加载任何内容。
这里是一些链接:
http://localhost:49602/Messages/Index#/
http://localhost:49602/Messages/Index#/sent
http://localhost:49602/Messages/Index#/create
我的猜测是,我没有使用角/ jQuery的的正确版本还是我失去了一些包?
试图在浏览器中查看一个模板,并得到了另一个错误:与计算器的帮助
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
2016-06-16
Eduard
+1
你可以试试 >> http:// localhost:49602/Messages /#/ >> http:// localhost:49602/Messages /#/ sent >> http:// localhost:49602/Messages /#/ create –
+0
well我得到这个:'HTTP Error 403.14 - Forbidden Web服务器被配置为不列出这个目录的内容。' –
+0
我还添加了这个< /system.webServer>' –