Programmatically use ASP to establish a Web site in IIS

zhaozj2021-02-16  76

'' Create a webserver '' must be parameter: Wroot, for the physical directory of the site; WComment is a site description; WPORT is the site port; ServerRun is automatically running & n bsp; '' When the creation is successful, it will be returned. And return 0, return 2 '' *************************************************************************** ******************************************************** '' ***************** Note: WPORT is the list type, meaning server port, ************* '' Function is passed on IIS5.0, ** must log in to the ** 'port as administrator:' 'DIM WPORT, BINDLISTS, CREATEFLAG, OComputer' 'OComputer = "localhost"' BINGLISTS = array (0) '' BINGLISTS (0) = ": 80:" '' port number 80 '' wport = binglists' 'createflag = CreateWebserver ("D: / MyWeb", "My Home", WPORT, FALSE' 'Calling Station Function' 'If recreatflag = 0 THEN' '' '' '' '' '' '' ELSEIF CRITEFLAG = 2 THEN 'ELSEIF CREATEFLAG = 2 THEN' 'ELSEIF CREATEFLAG = 2 TEN' 'ELSEIF CREATEFLAG = 2 TEN' 'RESPONSE .Write "created site success, but the startup site failed, possible port conflicts!" '' End if '' ************************** *********************************************************** * Function CreateWebServer (WRoot, WComment, wPort, ServerRun) On Error Resume Next Dim ServiceObj, ServerObj, VDirObj Set ServiceObj = GetObject ( "IIS: //" & oComputer & "/ W3SVC") '' first, create a service instance WNumber = 1 do while isobject (ServiceObj.getObject ("IisWebserver", Wnumber) f err.Number <> 0 Then err.clear () exit do end if wnumber = WNUMBER 1 loop set serverobj = serviceObj.create ("IisWeb Server", Wnumber) '' and create a web server if (Err.Number <>

转载请注明原文地址:https://www.9cbs.com/read-14280.html

New Post(0)