在IIS中建立WEB站点的例子!
public Sub CreateIISWebServer()
Dim obj As Object
Dim Web,NewWeb,Child,VirDir As Object
Dim SBinds()
Dim Ip,HostName,Iistallpath As string
Ip = " 192 . 168 . 0 . 1 " ' Ip address
HostName = " www . HostName . com " ' Host header
Iistallpath = " C:\ inetpub \ myweb path " '目录路径
dimwebpath
do while err . number 0
ifmsgbox("此服务器的Internet Iformation Server未启动,请启动它并重试。",vbRetryCancel," IIS服务未启动")= vbcancel然后end
err . clear
set Web = getobject(" IIS://localhost/w3svc ")
loop
err . clear
For Web中的每个子级
If IsNumeric(Child。Name)然后
If CInt(Child。name)> = WebName Then WebName = CInt(Child。name)+1
End If
Next
Set new Web = Web。Create("IIsWebServer ",Webname)
new web . server comment = " site description "
new web . key type = " IIS web server "
redims binds(0)
sbinds(0)= IP & ":" & port & ":" HostName
new web。server bindings = SBinds
new web . access read = True
new web . front page web = True
new web。EnableDefaultDoc = True
new web。DefaultDoc = "Default.htm,Default.htm,Index.asp,Index.asp"
NewWeb。AccessScript = True
NewWeb。access execute = True
Set VirDir = new web。Create("IIsWebVirtualDir "," Root")
VirDir。path = IIS installpath
VirDir。app create " TRUE "
virdir . setinfo
new web . setinfo
new web . start
末端接头
private Sub command 1 _ Click()
CreateIISWebServer
0条评论