网上有很多对iis进行操作的代码,比如常见的飞刀的那个iismanager,或者用脚本adsutil等等,但是这些代码都是在winform或者console下进行的,我把它们放到一个webform中来调用,马上都不行了,我估计应该是权限的问题吧,进行了如下设置:
1。machine.config中processmodel中的username改为SYSTEM;
2。在iis中把目录安全中的匿名访问用户由IUSE_XXX改为Administrator结果还是不行,同样的问题还有如何在webform里操作注册表,不知道各位兄弟是如何解决的啊??另:兄弟们千万不要再大段大段的贴如何操作iis的代码了:)

解决方案 »

  1.   

    <%@ Page Language="C#" ASPCompat="true" %>在@Page 中加上ASPCompat="true"看看可不可以
      

  2.   

    发现如下问题:
    在我的机器上调用create和appcreate才有效(调c#的代码也是一样),但是其他的脚本就一点效果都没有,换其他机器,有的根本没反应,但是有的竟然都有效果!!我现在实在不知道该怎么设置权限了,管理员,改system用户名,修改iis目录安全,几乎该试的都试了,兄弟们救救我啊!!
      

  3.   

    web下权限很有限的,因为IIS的权限就很有限,你想在WEB下操作,那只有给IIS增加权限了.可这样就不安全了,自己衡量了.
      

  4.   

    请问楼上的兄弟如何给iis增加权限??
      

  5.   

    应该是权限问题。你可以把aspnet加到管理员组测试
      

  6.   

    孟子老哥终于等到你了!!
    我把aspnet加入管理员组了啊已经!如果不行的话应该都不行啊,但是我用adsutil的话只有create和appcreatepoolproc那几个参数才有效,而get、set都无效,在一台机器上什么都不用设置全部都可以,另一台无论如何都不行,还有一台跟我的毛病一样!!我现在都不知道该怎么做了!!
      

  7.   

    在web.config中启用模拟:<configuration>
    <system.web>
    <identity impersonate="true" userName="管理员帐号" password="密码"/>
    </system.web>
    </configuration>
      

  8.   

    用Windows集成身份验证,然后模拟管理员。
      

  9.   

    我做过,就是IIS权限问题,匿名设置为管理员就可以
      

  10.   

    http://support.microsoft.com/default.aspx?scid=kb;zh-cn;187506#appliesto要为访问 IIS 的用户配置所需的最低 NTFS 权限,请将以下目录权限授予匿名 Internet 用户帐户(默认情况下为 IUSR_computer_name 帐户),以及需要访问 Web 服务器的任何其他帐户或组: 目录 权限
    ------------------------------------------------
    Content READ (RX)Winnt READ (RX)Winnt\System32 READ (RX)Winnt\System32\Inetsrv READ (RX)Program Files\Common Files READ (RX)
    (及其所有子目录)

    注意:在 IIS 3.0 中,Active Server Pages 是附加产品,它位于自己的文件夹中。因此,您所安装的 IIS 3.0 如果要运行 ASP,需要对 Winnt\System32\Inetsrv\Asp 文件夹设置 READ (RX) 权限。用户使用 Web 浏览器能够访问的一切(如 Web 页、图像、文件)都可以定义为内容。默认情况下,万维网发布服务的内容文件夹是 \InetPub\Wwwroot,FTP 服务的内容文件夹是 \InetPub\Ftproot。IIS 要求同时具备相应的 NTFS 权限和用户权限,才能访问 Web 服务器。下表列出身份验证类型,以及使用指定的身份验证类型所需的相应用户权限: 身份验证类型 所需用户权限
    -------------------             -------------------
    匿名 本地登录(禁用密码同步)
    匿名 从网络访问此计算机(启用密码同步)
    基本(明文) 本地登录
    NT 质询响应 从网络访问此计算机
    简要(仅适于 IIS 5.0) 从网络访问此计算机
    集成(仅适于 IIS 5.0) 从网络访问此计算机
      

  11.   

    Grant Ownership and Permission to Administrators and System
    To assign permissions to the system: 
    Open Windows Explorer. To do this, click Start, click Programs, and then click Windows Explorer. 
    Expand My Computer. 
    Right-click the system drive (this is typically drive C), and then click Properties. 
    Click the Security tab, and then click Advanced to open the Access Control Settings for Local Disk dialog box. 
    Click the Owner tab, click to select the Replace Owner on Sub containers and Objects check box, and then click Apply. If you receive the following error message, click Continue: An error has occurred applying security information to %systemroot%:\Pagefile.sys
    If you receive the following error message, click Yes: You do not have permission to read the contents of directory %systemroot%:\System Volume Information - Do you want to replace the directory permission - All permission will be replaced granting you Full Control
    Click OK to close the dialog box. 
    ClickAdd. 
    Add the following users, and then grant them the Full Control NTFS permission: 
    Administrator 
    System 
    Creator Owner 
    After you have added these NTFS permissions, click Advanced, click to select the Reset permission on all child objects and enable propagation of inheritable permissions check box, and then click Apply. 
    If you receive the following error message, click Continue: An error has occurred applying security information to %systemroot%:\Pagefile.sys
    After you have reset NTFS permissions, click OK. 
    Click the Everyone group, click Remove, and then click OK. 
    Open the properties for the %systemroot%\Program Files\Common Files folder, and then click the Security tab. Add the account that is used for anonymous access (by default, this is the IUSR_<MachineName> account) and the Users group, and then make sure that only the following are selected: 
    Read & Execute 
    List Folder Contents 
    Read
    Open the properties for the root directory that holds your Web content (by default, this is the %systemroot%\Inetpub\Wwwroot folder). Click the Security tab, add the IUSR_<MachineName> account and the Users group, and then make sure that only the following are selected: 
    Read & Execute 
    List Folder Contents 
    Read
    If you want to grant Write NTFS permission for Inetpub\FTProot or the directory path for your FTP site or sites, repeat step 15.Note Microsoft does not recommend that you grant NTFS Write permissions to the anonymous account in any directories, including directories used by the FTP service uses. This can cause unnecessary data to be uploaded to your Web server.