如何在 .NET 中使用 MSAdminBase COM 对象?
该对象在 %windir%\system32\ADMWPROX.DLL 中实现 - 请参阅 HKEY_CLASSES_ROOT\CLSID\{70B51430-B6CA-11D0-B9B9-00A0C922E750}
它完全可以从C 代码,但我希望将其替换为 .NET 代码,这真是太糟糕了 - ADMWPROX.DLL 没有作为 tlbimp 的有效类型库出现:
z:\Work>tlbimp c:\Windows\system32\admwprox.dll
Microsoft (R) .NET Framework Type Library to Assembly Converter 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.
TlbImp : error TI1002 : The input file 'c:\Windows\system32\admwprox.dll' is not a valid type library.
z:\Work>
当然,在 Visual Studio 中添加 COM 引用时,COM 对象列表中缺少它。
PS:我正在尝试设置 IIS://localhost/W3SVC/1!SslCertHash
属性和 本文解释说,唯一的方法是通过 MSAdminBase
对象,而不是 MSAdminObject
(由于架构定义中的错误) )。后者可以方便地由 .NET System.DirectoryServices.DirectoryEntry
包装,但前者不是 - 因此是我的痛苦。
This object is implemented in %windir%\system32\ADMWPROX.DLL - see HKEY_CLASSES_ROOT\CLSID\{70B51430-B6CA-11D0-B9B9-00A0C922E750}
It is perfectly usable from C code, but I wish to replace it with a .NET code and what a bummer - ADMWPROX.DLL does not appear as a valid type library to tlbimp:
z:\Work>tlbimp c:\Windows\system32\admwprox.dll
Microsoft (R) .NET Framework Type Library to Assembly Converter 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.
TlbImp : error TI1002 : The input file 'c:\Windows\system32\admwprox.dll' is not a valid type library.
z:\Work>
And of course, it is missing from the list of COM objects when adding a COM reference in Visual Studio.
PS: I am trying to set the IIS://localhost/W3SVC/1!SslCertHash
property and this article explains that the only way to do it is through the MSAdminBase
object, rather than MSAdminObject
(due to a bug in the schema definition). The latter is conveniently wrapped by the .NET System.DirectoryServices.DirectoryEntry
, but the former is not - hence is my pain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我是这样做的:
就是这样。
我没有创建互操作源代码作为第一步也是唯一的一步,因为 IMSAdminBase_W 接口相当大,所以我更愿意将其转换为 IDL,这样更容易。
OK, here is how I did it:
That's it.
I did not create the interop source code as the first and only step, because the IMSAdminBase_W interface is quite large, so I preferred to convert it to IDL, which was easier.