简体   繁体   English

替代本地安装IIS以远程访问IIS?

[英]Alternative to installing IIS locally to access IIS remotely?

I have an app that accesses information about websites running on IIS on a remote machine, using DirectoryEntry objects (in System.DirectoryServices). 我有一个应用程序,使用DirectoryEntry对象(位于System.DirectoryServices中)访问有关在远程计算机上的IIS上运行的网站的信息。

Any client machine that runs the app needs to have IIS installed or the app throws a System.Runtime.InteropServices.COMException when it accesses the IIS information. 任何运行该应用程序的客户端计算机都需要安装IIS,否则该应用程序在访问IIS信息时会引发System.Runtime.InteropServices.COMException。

Is there a way I can just include a dll, add a reference, or something similar to be able to access that information without the client machine installing IIS? 有没有办法我可以仅包含一个dll,添加引用或类似的方法而无需客户端计算机安装IIS就可以访问该信息? Or is there a better way to access that information (without System.DirectoryServices, perhaps) that would also bypass this requirement? 还是有一种更好的方法来访问该信息(也许没有System.DirectoryServices),而该方法也会绕过此要求?

EDIT: Looking at this problem again, and seeing the questions here and here , I believe it is not possible to use DirectoryServices to get this information. 编辑:再次查看此问题,并在这里这里看到问题,我相信不可能使用DirectoryServices来获取此信息。 I'll leave it open for alternatives to be suggested, maybe more info on WBEM scripts? 我将其开放供其他建议使用,也许有关WBEM脚本的更多信息?

So what I understand is that you're trying to get website info from remote IIS servers, but the client that is trying to get that information must have IIS installed in order to be able to query those remote systems. 因此,据我了解,您正在尝试从远程IIS服务器获取网站信息,但是试图获取该信息的客户端必须安装IIS才能查询那些远程系统。 And it's not because it's using some kind of web-app to get the info; 这不是因为它正在使用某种Web应用程序来获取信息。 it's using some functionality that is installed when IIS is installed. 它使用的是安装IIS时安装的某些功能。

What kind of information are you after? 您想要什么样的信息? Can't you use WBEM scripts targeting the IIS machine to get the information you're after? 您不能使用针对IIS计算机的WBEM脚本来获取所需的信息吗?

After further research: 经过进一步研究:

Chris was talking about WMI scripts and the System.Management namespace, which works fine as long as you're connecting to IIS 6 or above. 克里斯正在谈论WMI脚本和System.Management命名空间,只要您连接到IIS 6或更高版本,它就可以正常工作。

DirectoryServices needs IIS installed, because it adds extra bits to ADSI that allow it to query IIS. DirectoryServices需要安装IIS,因为它向ADSI添加了额外的位以允许其查询IIS。 In addition, you need to install an IIS 6 compatibility manager if you're using IIS 5 (Windows XP) or IIS 7 (Windows 7) to get the right ADSI components. 此外,如果您使用IIS 5(Windows XP)或IIS 7(Windows 7)来获取正确的ADSI组件,则需要安装IIS 6兼容性管理器。

There is a final alternative for IIS 7, which is the Microsoft.Web.Administration namespace. IIS 7的最终替代方案是Microsoft.Web.Administration命名空间。

Unfortunately, in my scenario I need to use both IIS 5 and IIS 6, meaning that DirectoryServices is the only way to get what I need. 不幸的是,在我的场景中,我需要同时使用IIS 5和IIS 6,这意味着DirectoryServices是获得我所需要的唯一方法。 Luckily, I believe only a compatibility manager needs to be installed rather than the whole IIS server (hopefully this is an option on Windows XP...) 幸运的是,我相信只需要安装一个兼容性管理器,而不是整个IIS服务器(希望这是Windows XP上的一个选项...)

Accepted Chris as the answer for the suggestion on WBEM, even though I can't use it in this case! 接受Chris作为WBEM建议的答案,即使在这种情况下我也无法使用它!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM