当我请求包含以下 URL 的链接时,出现错误:http://xxx:46630/
或与此http://crmbyzaid.azurewebsites.net/
但当我添加时效果很好'/index.html'
与网址。现在,当我请求时,我想设置部分页面“app/dashboard/dashboard.html”的默认渲染http://crmbyzaid.azurewebsites.net/
我的代码配置路由.js is
function routeConfigurator($routeProvider, routes) {
routes.forEach(function (r) {
$routeProvider.when(r.url, r.config);
});
$routeProvider.otherwise({ redirectTo: '/' });
}
function getRoutes() {
return [
{
url: '/',
config: {
templateUrl: 'app/dashboard/dashboard.html',
title: 'dashboard',
settings: {
nav: 1,
content: '<i class="fa fa-dashboard"></i> Dashboard'
}
}
}, {
url: '/admin',
config: {
title: 'admin',
templateUrl: 'app/admin/admin.html',
settings: {
nav: 1,
content: '<i class="fa fa-lock"></i> Admin'
}
}
}
]
}
由于 Azure 在 IIS 上运行,因此您需要一个 web.config 来告诉它如何处理内容。这应该可以解决您的根页面问题:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
将文件命名为 web.config 并将其保存到您的 Web 根目录。
希望有帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)