2012-10-15 22 views
0

我爲我的應用程序創建了一個asp webapi來連接數據庫。在本地主機上開發時,一切正常。但是在發佈之後,沒有任何東西在主頁旁邊工作。它看起來像我的路由不發佈是出版後工作在azure上發佈後無法運行webapi

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

     routes.MapHttpRoute(
      name: "DefaultApi", 
      routeTemplate: "sd/{controller}/{action}" 
     ); 

     routes.MapHttpRoute(
      name: "ParamApi", 
      routeTemplate: "sd/{controller}/{action}/{param}", 
      defaults: new { param = RouteParameter.Optional } 
     ); 

     routes.MapHttpRoute(
      name: "GuestApi", 
      routeTemplate: "sd/{controller}/{action}/{username}/{password}/", 
      defaults: new 
      { 
       username = UrlParameter.Optional, 
       password = UrlParameter.Optional 
      } 
     ); 

     routes.MapHttpRoute(
      name: "BriefcasePutApi", 
      routeTemplate: "sd/{controller}/{action}/{id}/{value}/{owner}", 
      defaults: new { 
       id = RouteParameter.Optional, 
       value = RouteParameter.Optional, 
       owner = RouteParameter.Optional 
      } 
     ); 

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

唯一的工作後與名Default路線。其餘的都不是。我得到的錯誤是這樣的:

Server Error in '/' Application. 

Runtime Error 
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.\r\n 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".` 

當調用URL像我得到這個錯誤:http://domain.com/sd/content/get

在我的本地它工作完全正常,但不是在Azure上發佈

後我可能是錯的這是路由問題,但我不知道我能看到什麼。

我創建項目在.NET 4.5,但在此之後,我發現,我還不能使用它在蔚藍因此我將轉換爲4.0

UPDATE 確定。經過與控制器的快速檢查,我得到空白頁面。無錯誤:/

檢查是我的操作返回int數字「2」。所以我知道這個問題不是由一些代碼實際引起的。但是現在我沒有錯,沒有任何東西。只是空白頁

奇怪的事情:火狐返回空白頁,但Internet Explorer中返回錯誤500


回答以下

+0

這是一個雲服務或網站?如果前者,我會建立RDP訪問並查看VM –

+0

@ JimO'Neil中發生的事情,這是作爲網站託管的。我怎樣才能讓RDP訪問這個webstite並檢查呢? – Fixus

回答

1

我發現這個問題!

我已經從.NET 4.5退回到.NET 4.0,但實體框架沒有從5.0恢復到4.3.1,所以我不得不手動卸載v 5.0,然後從NuGet我不得不安裝4.3.1。之後,一切開始工作!