用VC修改IIS的属性 如设为可以匿名访问  将默认网站下的主目录路径C:\Inetpub\wwwroot 在VC程序里面可以更改成任意路径.
谢谢

解决方案 »

  1.   

    VC中可以用ADSI来操作IIS。参考:http://topic.csdn.net/t/20030224/15/1460500.html
      

  2.   

    PS :   ADSI (活动目录接口)
      

  3.   

    據説是用WMI或者ABO可以 沒用過 看看IIS SDK
      

  4.   

    当然可以,首先停止服务器(net stop W3SVC ) 修改注册表[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\@PathWWWRoot"="C:\\Inetpub\\wwwroot"
    net start W3SVC
      

  5.   

    上面说错,可以参照C:\Inetpub\AdminScripts下的脚本,只是vc里调用的是com组件罢了Sub ASTCreateVirtualWebDir(ComputerName,WebSiteName,DirNames,DirPaths)
    Dim Computer, webSite, WebSiteID, vRoot, vDir, DirNum
    On Error Resume Next

    set webSite = findWeb(ComputerName, WebSiteName)
    if IsObject(webSite) then
    set vRoot = webSite.GetObject("IIsWebVirtualDir", "Root")
    Trace "Accessing root for " & webSite.ADsPath
    If (Err <> 0) Then
    Display "Unable to access root for " & webSite.ADsPath
    Else
    DirNum = 0
    If (IsArray(DirNames) = True) And (IsArray(DirPaths) = True) And (UBound(DirNames) = UBound(DirPaths)) Then
    While DirNum < UBound(DirNames)
    'Create the new virtual directory
    Set vDir = vRoot.Create("IIsWebVirtualDir",DirNames(DirNum))
    If (Err <> 0) Then
    Display "Unable to create " & vRoot.ADsPath & "/" & DirNames(DirNum) &"."
    Else
    'Set the new virtual directory path
    vDir.AccessRead = true
    vDir.Path = DirPaths(DirNum)
    If (Err <> 0) Then
    Display "Unable to bind path " & DirPaths(DirNum) & " to " & vRootName & "/" & DirNames(DirNum) & ". Path may be invalid."
    Else
    'Save the changes
    vDir.SetInfo
    If (Err <> 0) Then
    Display "Unable to save configuration for " & vRootName & "/" & DirNames(DirNum) &"."
    Else
    Trace "Web virtual directory " & vRootName & "/" & DirNames(DirNum) & " created successfully."
    End If
    End If
    End If
    Err = 0
    DirNum = DirNum + 1
    Wend
    End If
    End If
    else
    Display "Unable to find "& WebSiteName &" on "& ComputerName
    End if
    Trace "Done."
    End Sub