2015-10-13 53 views
0

本地網站工作正常,當部署到Azure時,我們得到視圖索引或其主人未找到或沒有視圖引擎支持搜索的位置。Azure MVC Angular Project找不到首頁

Routeconfig

 public static void RegisterRoutes(RouteCollection routes) 
    { 
     routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 

     routes.MapRoute(
      name: "websitename", 
      url: "", 
      defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 

     ); 
     routes.MapRoute(
      name: "Default", 
      url: "{controller}/{action}/{id}", 
      defaults: new { controller = "{controller}", action = "{action}", id = UrlParameter.Optional } 

     ); 

我們使用angularjs直到部署到Azure除了這個問題有沒有問題。

+0

[視圖或它的主人可能的複製沒有被發現或沒有視圖引擎支持搜索的位置](http://stackoverflow.com/questions/18273416/the-view-or-its-master-was-not-found-or-no-view-engine-supports-the-searched- loc) – Claies

回答

0

您爲主頁定義以下權限?

routes.MapRoute(
     name: "DoransData", 
     url: "", 
     defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 

    ); 

將其更改爲

routes.MapRoute(
     name: "DoransData", 
     url: "{controller}/{action}/{id}", 
     defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 

    ); 

基於您的代碼,我認爲你可能只需要下面的代碼

public static void RegisterRoutes(RouteCollection routes) 
    { 
     routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 

     routes.MapRoute(
      name: "Default", 
      url: "{controller}/{action}/{id}", 
      defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
     ); 

    } 
+0

沒有運氣或改變 – user1552172