Can I automate creating a .NET web application / virtual directory in IIS 5?

前端 未结 1 810
孤独总比滥情好
孤独总比滥情好 2020-12-10 09:09

I asked this Can I automate creating a .NET web application in IIS? a little ago, and got solutions for IIS 6 and IIS 7:

  • IIS6 : iisweb /create C:\\Rome \
相关标签:
1条回答
  • 2020-12-10 09:27

    You can access the IIS 5.1 metabase in VBScript, and this allows you to create a virtual directory. For example, this should set up a Virtual Directory called 'TestDir' that points to the folder C:\inetpub\wwwroot\Test

    strComputer = "localhost"
    strVdirName = "TestDir"
    strVdirPath = "C:\Inetpub\wwwroot\Test"
    
    set objIIS = GetObject("IIS://" & strComputer & "/W3SVC/1")
    set objWebSite = objIIS.GetObject("IISWebVirtualDir","Root")
    set objVdir = objWebSite.Create("IISWebVirtualDir",strVdirName)
    objVdir.AccessRead = True
    objVdir.Path = strVdirPath
    objVdir.AppCreate (True)
    objVdir.SetInfo
    WScript.Echo "Successfully created virtual directory: " & objVdir.Name
    
    0 讨论(0)
提交回复
热议问题