我在使用此网址请求链接时收到错误:http://xxx:46630/
或此http://crmbyzaid.azurewebsites.net/
但是当我使用URL添加'/index.html'
时,它工作正常。现在我想设置我的部分页面的默认渲染" app / dashboard / dashboard.html"当我仅使用http://crmbyzaid.azurewebsites.net/
config-route.js 的代码是
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'
}
}
}
]
}
答案 0 :(得分:0)
由于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-root。
希望有所帮助!