zoukankan      html  css  js  c++  java
  • DirectoryEntry配置IIS出现ADSI Error:未知错误(0x80005000)

    目录

    问题案例

    原因分析

    解决问题

    总结

    问题案例

    DirectoryEntry配置IIS,在IIS6.0下运转正常,但IIS7.0下运转会出错: 

    System.DirectoryServices.DirectoryEntry iisServer;
    iisServer = 
    new System.DirectoryServices.DirectoryEntry("IIS://LOCALHOST/W3SVC/");//此处抛出异常

    异常内容如下: 

    System.Runtime.InteropServices.COMException (0x80070003): 系统找不到指定的路径。
    
       在 System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
       在 System.DirectoryServices.DirectoryEntry.Bind()
       在 System.DirectoryServices.DirectoryEntry.get_IsContainer()
       在 System.DirectoryServices.DirectoryEntries.ChildEnumerator..ctor(DirectoryEntry container)
       在 System.DirectoryServices.DirectoryEntries.GetEnumerator()

    原因分析

    排除原因 :IIS6的管理兼容性。

    因为在 “控制面板”->“程序和功能”->面板左侧“打开或关闭windows功能”->“Internet信息服务”->“Web管理工具”->“IIS 6管理兼容性”。已全部打钩。

    有查到资料说是这方面的原因

    解决问题

     在网上找了各种方式,但是始终不得人意。最后发现了DirectoryEntry的入参有如下区别:

    DirectoryEntry appPools = new DirectoryEntry(“IIS://LOCALHOST/W3SVC/”);   //报错
    /*
     其他操作
    */
    
    DirectoryEntry appPools = new DirectoryEntry(“IIS://LOCALHOST/W3SVC”);   //正常
    /*
     其他操作
    */

     

     

    总结

        解决了之后,再看一眼简直惊呆了....真的是一符之差( ⊙o⊙ )哇

  • 相关阅读:
    协成
    进程与线程-多线程
    进程与线程2
    进程与线程
    socket编程
    常用模块二(hashlib、configparser、logging)
    异常处理
    python之路——面向对象进阶
    封装
    初识——面向对象
  • 原文地址:https://www.cnblogs.com/xiaotiannet/p/3435574.html
Copyright © 2011-2022 走看看