I have an app that accesses information about websites running on IIS on a remote machine, using DirectoryEntry objects (in System.DirectoryServices).
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.
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? Or is there a better way to access that information (without System.DirectoryServices, perhaps) that would also bypass this requirement?
EDIT: Looking at this problem again, an开发者_高级运维d seeing the questions here and here, I believe it is not possible to use DirectoryServices to get this information. I'll leave it open for alternatives to be suggested, maybe more info on WBEM scripts?
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. And it's not because it's using some kind of web-app to get the info; it's using some functionality that is installed when IIS is installed.
What kind of information are you after? Can't you use WBEM scripts targeting the IIS machine to get the information you're after?
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.
DirectoryServices needs IIS installed, because it adds extra bits to ADSI that allow it to query 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.
There is a final alternative for IIS 7, which is the Microsoft.Web.Administration namespace.
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. 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...)
Accepted Chris as the answer for the suggestion on WBEM, even though I can't use it in this case!
精彩评论