我在示例.NET WebApi應用程序中嘗試了Breeze.js框架。我有幾個控制器設置工作,並使用Unity.WebApi注入應用程序的工作單元。Breeze和Unity不能在ASP.NET WebApi應用程序中一起工作
我正在使用實體框架6,所以我使用「Breeze客戶端和服務器 - 使用ASP.NET Web API 2和實體框架6的Javascript客戶端」軟件包(id:Breeze.WebApi2.EF6)安裝Breeze。
Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
源錯誤:與不同的情況
Line 15: GlobalConfiguration.Configuration.DependencyResolver =
Line 16: new UnityDependencyResolver(container);
Line 17: }
Line 18:
Line 19: private static IUnityContainer BuildUnityContainer()
谷歌搜索和StackOverflowing這個錯誤產生的結果,使那些這樣做,我添加了BreezeController,但現在我的應用程式的空檔給我下面的錯誤後哪裏沒有很大的幫助。然而,錯誤來自Unity的Bootstrapper文件,所以我刪除了Unity,然後我的Breeze控制器開始工作。把團結回來 - 它再次打破
微風控制器:
public class BreezeController : ApiController
{
readonly EFContextProvider<DataContext> _contextProvider =
new EFContextProvider<DataContext>();
[HttpGet]
public string Metadata()
{
return _contextProvider.Metadata();
}
[HttpGet]
public IQueryable<Category> Categories()
{
return _contextProvider.Context.Categories;
}
}
我認爲這就是我所做的。我從頭開始了一個項目,添加了幾個控制器,設置了Unity並且事情正在運行,只有當我安裝Breeze時它纔打破。 –
也許是因爲Breeze也更新了我正在使用的WebApi版本。我會盡力檢查。 –
值得檢查。過去幾週一直試圖在同一頁面上獲取所有不同的組件。對於「DLL地獄」的結尾非常重要:D。感謝您的耐心 – Ward