Solved

problem in IIsWebServer.start

Posted on 2001-07-18
4
207 Views
Last Modified: 2007-11-27
Hi There,
Here I pasted the code to create site in IIS. In this start command is not working. Can any of you explain why it's showing error.

Dim idxItem, idxNext, objNew, objRoot, dirObj, objDir
Dim svrComment, svrPath, svrDir, templete, images, emarketing

svrComment = Text2.Text
svrPath = Text3.Text
svrPath = svrPath & "\test"
templete = svrPath & "\templete"
images = svrPath & "\images"
script = svrPath & "\scripts"
Set dirObj = CreateObject("Scripting.FileSystemObject")
dirObj.CreateFolder (svrPath)
dirObj.CreateFolder (templete)
dirObj.CreateFolder (images)
dirObj.CreateFolder (script)


Text1.Text = ""
Text1.Text = Text1.Text & "Adding a Site..." & vbCrLf
Text1.Text = Text1.Text & "Getting the Next Available Server Index..." & vbCrLf
Set objComp = GetObject("IIS://localhost/W3SVC")

For Each idxItem In objComp
If IsNumeric(idxItem.Name) Then
If idxNext < idxItem.Name Then
idxNext = idxItem.Name
End If
End If
Next
idxNext = idxNext + 1
Text1.Text = Text1.Text & " (" & idxNext & ")" & vbCrLf

Text1.Text = Text1.Text & "Creating the New Site..." & vbCrLf
Set objNew = objComp.Create("IIsWebServer", idxNext)

BindingsList = Array(0)
BindingsList(0) = ":80:"
WPort = BindingsList

objNew.ServerSize = 1
objNew.ServerComment = svrComment
objNew.ServerBindings = WPort

objNew.SetInfo

Text1.Text = Text1.Text & "Creating Site Root..." & vbCrLf
Set objRoot = objNew.Create("IIsWebVirtualDir", "Root")
objRoot.Path = svrPath
objRoot.SetInfo


Text1.Text = Text1.Text & "Setting up Server..." & vbCrLf

objRoot.AuthAnonymous = True

objRoot.AccessRead = True

objRoot.AccessWrite = True

'objRoot.AccessExecute = True

objRoot.AccessScript = True

objRoot.SetInfo

Set objDir = objRoot.Create("IIsWebDirectory", "scripts")
objDir.AccessRead = False
objDir.AccessWrite = False
objDir.AccessExecute = True
objDir.ContentIndexed = False
objDir.SetInfo
Set objDir = Nothing

Text1.Text = Text1.Text & "Starting Server..." & vbCrLf
objNew.start ' This line is showing error

Text1.Text = Text1.Text & "Server Started..." & vbCrLf
Set objNew = Nothing
0
Comment
Question by:kvraja
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
CJ_S earned 20 total points
ID: 6293800
I believe you hafta use:
Set objComp = GetObject("IIS://localhost/W3SVC/1")

Not really sure though
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 6293804
and not objnew.Start but objComp.start

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7156168
Hi kvraja,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept CJ_S's comment(s) as an answer.

kvraja, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7182577
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question