[英]Which is better for IIS administration in ASP.Net : WMI or ADSI or Managed API? and what's the difference?
I am working on Configuring and manipulating and controlling IIS 6.0 and later versions using ASP.Net based web application. 我正在使用基于ASP.Net的Web应用程序配置和操作和控制IIS 6.0及更高版本。 I am considering WMI, ADSI, Managed API as my options. 我正在考虑WMI,ADSI,托管API作为我的选择。
I have a target Windows System WIN2k3 or later versions. 我有一个目标Windows系统WIN2k3或更高版本。 The choice of language is C# and the application has to be built using ASP.Net. 语言的选择是C#,应用程序必须使用ASP.Net构建。
This article describes each of the methods but i am a bit unsure about various things; 本文介绍了每种方法,但我对各种方法有点不确定; http://learn.iis.net/page.aspx/283/provisioning-options-in-iis7/rev/1 http://learn.iis.net/page.aspx/283/provisioning-options-in-iis7/rev/1
I have the following questions regarding these options. 关于这些选项,我有以下问题。
Which is better or more powerful for the stated goal? 对于既定目标哪个更好或更强大? ADSI(System.DirectoryServices) or WMI(Microsoft.Web.Management) or Managed API (Microsoft.Web.Administratoion)? ADSI(System.DirectoryServices)或WMI(Microsoft.Web.Management)或托管API(Microsoft.Web.Administratoion)? Correct me if i am doing something wrong here. 如果我在这里做错了,请纠正我。
Which option or technology is likely to be supported for later versions of IIS? IIS的更高版本可能支持哪种选项或技术?
I am less likely to work on II5.1 or below. 我不太可能在II5.1或更低版本上工作。 So the compatibility zone starts from IIS 6.0 and above. 因此兼容性区域从IIS 6.0及更高版本开始。 The application has to be built using ASP.Net and un-managed code may be used if unavoidable. 应用程序必须使用ASP.Net构建,如果不可避免,可以使用未托管代码。
Thanks 谢谢
Regards 问候
Steve 史蒂夫
For IIS 7 and up, you probably want IIS Management API . 对于IIS 7及更高版本,您可能需要IIS Management API 。 I assume you've already read the MSDN comparison of administration technologies . 我假设您已经阅读过管理技术的MSDN比较 。 Considering only 1 project, I would use whichever tool you are most familiar with. 仅考虑一个项目,我会使用您最熟悉的工具。 Everything involving direct manipulation of the IIS metabase requires a dedicated effort to learn. 涉及直接操作IIS元数据库的所有内容都需要专门的学习努力。
Given the learning curve, I choose to use WMI. 鉴于学习曲线,我选择使用WMI。 It is used broadly beyond IIS and mastering it feels like a good investment. 它被广泛用于IIS之外,掌握它感觉就像是一项很好的投资。 C# supports its well. C#很好地支持它。 If you know a little PowerShell, you can easily explore it using the "gwmi" object. 如果你知道一点PowerShell,你可以使用“gwmi”对象轻松探索它。 If using WMI from .NET start with the managed code generator . 如果从.NET使用WMI,请使用托管代码生成器 。
For IIS6 I'd use the System.DirectoryServices
namespace which is a managed wrapper around ADSI. 对于IIS6,我使用System.DirectoryServices
命名空间,它是ADSI的托管包装器。 I find this simpler to use compared to working with the IIS WMI providers. 与使用IIS WMI提供程序相比,我发现使用起来更简单。
For IIS7, and as Precipitous suggested , I'd use the new IIS 7 Managed Code Administration API ( Microsoft.Web.Administration
et al) . 对于IIS7和Precipitous建议 ,我将使用新的IIS 7托管代码管理API( Microsoft.Web.Administration
等)。 You can use the IIS6 compatibility components on IIS7 which maintain the old style ADSI API's for consumers (but are a wrapper around the new IIS7 components) and they mostly work. 您可以在IIS7上使用IIS6兼容组件,这些组件为消费者维护旧式ADSI API(但是它们是新IIS7组件的包装器)并且它们主要起作用。
However you do encounter problems with the ADSI wrappers. 但是,您确实遇到了ADSI包装器的问题。 For example they are ignorant of Handler Mapping (analogous to an IIS6 Script Map) properties such as preConditions
which, for example, permit multiple versions of ASP.NET's handler mapping definitions to co-reside in the same site or application. 例如,他们不知道Handler Mapping(类似于IIS6脚本映射)属性,例如preConditions
,例如,允许ASP.NET的处理程序映射定义的多个版本共存于同一站点或应用程序中。 The ADSI compatibility layer will create objects known as AboMapperCustom
objects which are sub-optimal in their configuration and are not aware of these new features. ADSI兼容层将创建称为AboMapperCustom
对象的对象,这些对象在其配置中是次优的,并且不了解这些新功能。
Having two code-bases (one for IIS6 and one for IIS7) may seem like a lot of work, but to be honest it isn't too bad. 有两个代码库(一个用于IIS6,一个用于IIS7)可能看起来很多工作,但说实话,它并不是太糟糕。 I work for a hoster, have been down this road, and we bit the bullet and decided that we'd maintain the old IIS6 code but start afresh with IIS7. 我为一个主机工作,一直走在这条路上,我们咬紧牙关,决定我们维护旧的IIS6代码,但重新开始使用IIS7。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.