[英]Moving from Castle Windsor to an IoC that runs under Medium Trust
我繼承了一個在已建立“完全信任”的主機上運行的項目,這是溫莎城堡IoC所必需的。 但是,新主機只能在Medium Trust中運行(大多數共享主機提供商也是如此),因此我需要用另一個IoC替換Windsor。
作為IoC的新手,我不確定在Medium Trust和Service Locator模型下哪種框架最適合使用。
現有注冊碼的示例如下:
IWindsorContainer container = new WindsorContainer();
ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));
container.RegisterControllers(typeof(HomeController).Assembly);
container.Register(
Component.For(typeof(IEntityDuplicateChecker))
.ImplementedBy(typeof(EntityDuplicateChecker))
.Named("entityDuplicateChecker"));
container.Register(
AllTypes
.FromAssemblyNamed("Salient.Website.Data")
.Pick()
.WithService.FirstNonGenericCoreInterface("Salient.Website.Core"));
container.Register(
AllTypes
.FromThisAssembly()
.Pick()
.WithService.FirstNonGenericCoreInterface("Salient.Website.ApplicationServices"));
ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(container));
如果我對哪種框架適用有一定的指導,可以在中等信任度的共享托管下工作,並且希望有一個將其翻譯成示例的示例,那么可以避免每個框架的反復試驗。
托管服務商對部分信任的要求很奇怪,因為Microsoft已向托管服務商提供了指導,要求托管服務商應從中等信任遷移,並使用適當的OS級隔離(請參閱此處和此處以及此處 )。 ASP.NET團隊的官方立場是Medium Trust已過時,這意味着將不對新功能和框架進行部分信任支持的測試,也不會修復該領域的錯誤。
但是,還有其他一些框架可以部分信任地運行:
可能還有其他,但我知道這些。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.