注入依賴我用Castle.Windsor作爲IoC容器,並試圖註冊這裏描述的類似的方式依賴關係:http://blog.ploeh.dk/CommentView,guid,f1a71969-0584-4a15-9395-9f2ac65f104b.aspx#commentstart我寫了下面的代碼:WCF並通過Castle.Windsor
public class RiverdaleServiceHostfactory : DefaultServiceHostFactory
{
public RiverdaleServiceHostfactory()
: base(CreateKernel())
{
}
private static IKernel CreateKernel()
{
InversionOfControl.RegisterAll();
InversionOfControl.Container.AddFacility<WcfFacility>();
return InversionOfControl.Container.Kernel;
}
}
它給我有關數據合同的錯誤無法在由服務「CustomerSearchService」實現的合同列表中找到合同名稱「Riverdale.Api.DataContracts.CustomerInfoType」。我檢查了屬性,配置,所有配置都應該如此。看起來圖書館已經考慮過自從這篇文章後發生的變化,並且知道這不是要走的路。
更重要的,我已經下載了3.0版本的WCF設施,並在那裏演示我的電腦上無法正常工作本地話說:
未能加載類型「Castle.Facilities.WcfIntegration.Demo 。全球'。
這樣做的最佳做法是什麼?我錯過了什麼?