2014-10-11 87 views
0

我得到一個錯誤,當我要求的鏈路與此網址:http://xxx:46630/或與此http://crmbyzaid.azurewebsites.net/如何設置默認頁角

但它的工作很好,當我加'/index.html'與URL。現在我想設置默認渲染我的部分頁面「應用程序/儀表板/ dashboard.html」當我要求只是http://crmbyzaid.azurewebsites.net/

我的配置,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

當您嘗試訪問根網址時,您遇到了什麼錯誤? – Fedaykin 2014-10-12 14:12:56

+0

@Fedaykin服務器錯誤在'/'應用程序 – 2014-10-13 05:37:18

回答

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根目錄。

希望有幫助!

+0

system.webServer有無效的孩子重寫 – 2014-10-11 12:41:42

+0

我跟着這個鏈接,但沒有好處http://stackoverflow.com/questions/25271758/asp-net-redirect-non-existing-pages -to-主頁功能於網絡的配置 - 使用重寫規則 – 2014-10-11 12:42:45