2013-06-24 35 views
1

利用微風的Devcurry hottowelsignalr example工作正常,直到我通過nuget升級到1.3.6。微風1.3.6無法獲取元數據

ch12中的F12顯示它試圖從http://localhost/api/breeze/Metadata檢索元數據,而之前它將使用 http://localhost/OnlineCollaborationWithSignalR/api/breeze/Metadata。這是通話的正確位置。看起來應用程序的路徑從根目錄中缺失。即(OnlineCollaborationWithSignalR

更新 注意到的發行說明1.3.1。隨後改變了路由

public static class BreezeWebApiConfig { 

    public static void RegisterBreezePreStart() { 
     GlobalConfiguration.Configuration.Routes.MapHttpRoute(
      name: "BreezeApi", 
      routeTemplate: "breeze/{controller}/{action}" 
    ); 
    } 
    } 

和應用程序/的ViewModels/home.js到

// service name is route to the Web API controller 
    var serviceName = 'breeze/Breeze'; 

from 
    // service name is route to the Web API controller 
    var serviceName = 'api/Breeze'; 

它仍然失敗,相同的錯誤如上所述。

回答

2

您能否確認該API響應?

根據您的routeTemplate,它應該是。

http://localhost/breeze/Breeze/Metadata

UPDATE:

是的,如果你的配置是這樣的。它應該是

http://localhost/OnlineCollaborationWithSignalR/breeze/Breeze/Metadata

我不熟悉具體的項目,但我下載並更新它。然後,我做出了您指定的更改,並且獲得了API的響應。雖然我收到了一個錯誤(很可能不相關),但實際上它的路由正確。

爲了記錄在案,我得到的錯誤是:

"The provider for invariant name 'System.Data.SqlClient' is specified multiple times in the application configuration. The invariant name must be unique for each configured provider."

+0

從我的MVC的理解/的WebAPI routeconfig因爲我的應用程序從http運行://本地主機/ OnlineCollaborationWithSignalR /這條路應該是http://localhost/OnlineCollaborationWithSignalR/breeze/Breeze/Metadata – Tim

+0

我懷疑你的SQL問題與你更改爲使用SQLExpress相關,當我更改爲使用IIS而不是vs2012的iisexpress時,它會提示你使用sqlexpress而不是localdb。 IVe從頭開始再次嘗試,仍然收到元數據錯誤,因爲它試圖從iis根而不是部署位置請求資源。 – Tim