AngularJS html5Mode 路由问题托管在 IIS 8.5 中
AngularJS html5Mode routing problems hosted in IIS 8.5
当我尝试浏览我的 AngularJS 应用程序的路由时,我要么收到403.14 - Forbidden
错误,要么收到404 - Not Found
错误。
当我尝试导航到基本 URL 时,我得到一个 403。
示例:http://localhost/Board.WebApp/给出 403。
对于所有其他路线,我得到403。
示例:http://localhost/Board.WebApp/template1 给出 404。
似乎有什么问题?这是我的代码:
默认值.html:
<!DOCTYPE html>
<html xmlns:ng="http://angularjs.org" xmlns="http://www.w3.org/1999/xhtml" id="app">
<head>
<title>Board</title>
<link rel="stylesheet" href="css/app.css" />
<base href="/Board.WebApp/" />
</head>
<body ng-cloak>
<section id="local-content" ng-view></section>
</body>
</html>
路线.js
function (module, amd) {
'use strict';
var mod = angular.module('routes', ['ngRoute']);
mod.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: true
}); // for pushState routing support instead of # hash
$routeProvider
.when("/", amd.route(
{
templateUrl: 'views/home.html',
controller: 'eventController',
controllerUrl: 'app/controllers/eventController'
}))
.when("/template1", amd.route(
{
templateUrl: 'views/templates/template1.html',
controller: 'eventController',
controllerUrl: 'app/controllers/eventController'
}))
}]);
});
如果要
在HTML5模式下运行,则需要一些服务器端配置:服务器必须重写指向应用程序入口点的链接。
相关文章:
- IIS动态HTTP响应标头
- 显示IIS上javascript文件(SOAP请求)的XML响应
- ASP.NET IIS应用程序中的客户端脚本缓存
- html5mode角度给定异常
- JavaScript在调试器中工作,但在发布到IIS时不工作
- 如果应用程序托管在IIS上,则Javascript window.location.htm不起作用
- 是(或可以)nodejshttp服务器替代Apache或IIS等大型服务器
- $locationProvider html5mode导致“;无法获取“;刷新时出错-AngularJS Node应用程
- angularjs中的相对href路径与html5mode错误
- 意外的令牌<当使用MEAN部署到iis服务器时
- JavaScript文件在IIS上返回404 Not Found
- Angular1.3路由的直接URLS问题-即使html5mode为false
- 将TCP侦听器或HTTP侦听器与IIS一起使用
- AngularJS URL使用$locationProvider.html5Mode进行了转义(true)
- 将内容编码标头附加到IIS 7.5中的特定文件
- 角度解析 url 与 LocationHashbangUrl 但 $locationProvider.html5Mode
- IIS中的AngularJS路由
- 在设置 IIS Express 以识别 JSON 文件类型后 - VS 是否可以调用除纯文本之外的更好的编辑器
- AngularJS html5mode = 当我使用参数直接访问 url 时出现真正的错误
- AngularJS html5Mode 路由问题托管在 IIS 8.5 中