连接到远程 2008 服务器上的 IIS 元数据库

发布于 2024-08-20 22:27:48 字数 348 浏览 6 评论 0原文

我编写了一些代码来检查 iis 元数据库,以查看安装了哪些站点及其虚拟目录的保存位置。该代码在服务器本地运行时运行良好。

我正在尝试扩展它,以便它可以远程工作。我正在努力让它进行身份验证。我目前正在使用 LogonUser api,但这在登录时总是返回 false

  • 我知道我拥有的凭据很好
  • 我和服务器之间没有防火墙
  • 如果我运行应用程序时没有从命令行进行 LogonUser API 调用和用户运行时,我收到错误:COMException (0x80005000)

如有任何想法,我们将不胜感激。

I have written a bit of code that inspects the iis metabase to see what sites are installed and where their virtual directories are kept. THis code runs fine when run locally on the server.

I am trying to extend it so that it works remotely. The thing I'm struggling with getting it to authenticate. I'm currently using the LogonUser api, but this always returns false on logon

  • I know the credentials I have are good
  • I don't have a firewall between me and the server
  • If I run the app with out the LogonUser API call and user runas from the command line I get the error: COMException (0x80005000)

Any thoughts would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

邮友 2024-08-27 22:27:48

通常,如果您在远程服务器上执行编程管理,您会将凭据传递给 API。例如,如果您使用 System.DirectoryServices,那么您需要执行以下操作:

string server = "MyHost";
string username = "bob";
string password = "bob123$";
string path = "IIS://" + server + "/W3SVC/1";

DirectoryEntry de = new DirectoryEntry(path, username, password);

Normally if you're performing programmatic administration on a remote server you'd pass the credentials to the API. For example if you're using System.DirectoryServices then you'd do:

string server = "MyHost";
string username = "bob";
string password = "bob123$";
string path = "IIS://" + server + "/W3SVC/1";

DirectoryEntry de = new DirectoryEntry(path, username, password);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文