Re: ADSI script for IIS 5.0 can not run in IIS 6.0

From: David Wang [Msft] (someone_at_online.microsoft.com)
Date: 11/28/04


Date: Sun, 28 Nov 2004 01:27:44 -0800

The only way to determine "why" is for someone to look at the source code.
Please be patient.

-- 
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Henry Zhang" <henry.zhang@altohiway.com> wrote in message
news:93392591.0411250737.11c2e797@posting.google.com...
Problem fixed by changing the array for ServerBindings from dynamic array to
static array.
Replace "ReDim NewBindings(Me.HostCount)" by "NewBindings = Array(0)"
But do not know the reason. Anybody know why?
"David Wang [Msft]" <someone@online.microsoft.com> wrote in message
news:<OOlqpiq0EHA.2824@TK2MSFTNGP09.phx.gbl>...
> Ok, I can reproduce that.  I am asking folks that work on IIS's scripting
> API for an explanation.  With Thanksgiving coming up, it is likely that it
> won't be answered until early next week at the soonest.
>
> It seems that something happens with the ReDim.  If I do not ReDim the
array
> and just substitute its values, things are ok.
>
> -- 
> //David
> IIS
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> //
> "Henry Zhang" <Henry Zhang@discussions.microsoft.com> wrote in message
> news:390D1FEC-8A00-43B6-A0BE-C879DDEAC0C3@microsoft.com...
> I have narrowed down the prblem to the statement "SiteObj.ServerBindings =
> NewBindings". when I commeted it out, there will be no errors.
>
> So the problem is in the following code:
>
> ReDim NewBindings(Me.HostCount)
>         For i = 0 To Me.HostCount - 1
>             BindingString = Website.Hosts(i).IP & ":" &
> Website.Hosts(i).Port & ":" & Website.Hosts(i).HostName
>              NewBindings(i) = BindingString
>         Next
> Is it allowed to use array as ServerBindings?
>
> "David Wang [Msft]" wrote:
>
> > Please narrow down what exactly is failing in your code.
> >
> > You have given insufficient information on what exactly is failing.
This
> > block of code was also not given in the original question -- so it is
> > unclear whether the original "issue" was resolved or was a red-herring,
>  etc.
> >
> > In any case,  SiteObj.SetInfo basically commits all the changes you had
> > done -- so it is not necessarily the "problem".  You should be able to
> > figure out exactly what change is failing to commit by commenting out
> > property manipulation one by one.  Currently, since you do not show any
of
> > the values being set to the properties in question, it is simply not
> > possible to help you.
> >
> > Here is documentation for all the properties:
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/alphabeticmetabasepropertylist.asp
> >
> > -- 
> > //David
> > IIS
> > This posting is provided "AS IS" with no warranties, and confers no
>  rights.
> > //
> > "Henry Zhang" <Henry Zhang@discussions.microsoft.com> wrote in message
> > news:FEF0DB75-4A90-40C5-9ECA-5C5853F2941B@microsoft.com...
> > The error message comes after the running of SiteObj.SetInfo
> >
> > The same error message also comes after the running of .SetInfo in the
> > following code in the same program.
> >
> >   With SiteObj
> >         .ServerComment = Website.ServerComment
> >         .LogType = Website.LogEnabled
> >         .LogFileDirectory = Website.LogDirectory
> >         '.LogPluginClsid = GetNCLogCLSID(Website.Computer)
> >         .LogPluginClsid = Website.LogPluginClsid
> >         .LogExtFileFlags = Website.LogExtFileFlags
> >         .LogFilePeriod = 3
> >         .AccessScript = True
> >         .AccessRead = True
> >         .AccessExecute = False
> >
> >         ' These properties are common to ROOT dir and to the web server
> >         .AppIsolated = Website.ApplicationIsolation
> >         .DefaultDoc = Website.DefaultPages
> >         .SetInfo
> >     End With
> >
> >     If Err.Number <> 0 Then
> >         strError = "Error Setting Webserver Properties" &
Err.Description
> >         UpdateSite = UpdateSite & vbCrLf & strError
> >         m_Debug.LogEvent App.EXEName, "Setting WebServer Properties",
> > vbLogEventTypeError, 1
> >         Err.Clear
> >     End If
> >
> > The aim of the program is to create and manage web site hosting in the
web
> > server. The whole package of the program can be found on
> > http://henryz.webtest.hiway.co.uk/AltoIISAutomation_my/
> >
> > The files need to be concern is Site.cls and readme.doc. Site.cls gives
>  the
> > source code.
> >
> > Thanks,
> > Henry
> >
> > "David Wang [Msft]" wrote:
> >
> > > Your code snippet (after I remove all the non-IIS/ADSI portions) runs
> > > perfectly for me on IIS6 and IIS5.  What is your actual problem?
> > >
> > > Can you please determine what function call resulted in "Invalid
>  procedure
> > > call or argument"?
> > >
> > > -- 
> > > //David
> > > IIS
> > > This posting is provided "AS IS" with no warranties, and confers no
>  rights.
> > > //
> > > "Henry Zhang" <henry.zhang@altohiway.com> wrote in message
> > > news:93392591.0411180125.4e62ec2a@posting.google.com...
> > > Hi,
> > >
> > > The following code can work in IIS 5.0, but have error message
> > > "Invalid procedure call or argument " when running on IIS 6.0. Can
> > > somebody help me to figure it out? Thanks.
> > >
> > > Set SiteObj = GetObject("IIS://" & Website.Computer & "/w3svc/" &
> > > Website.IISID)
> > >
> > >     ' Set the Bindings we want for the Hosts. So clear them out and
> > > reset
> > >     If Me.HostCount > 0 Then
> > >         ReDim NewBindings(Me.HostCount)
> > >         For i = 0 To Me.HostCount - 1
> > >             BindingString = Website.Hosts(i).IP & ":" &
> > > Website.Hosts(i).Port & ":" & Website.Hosts(i).HostName
> > >             m_Debug.LogEvent App.EXEName, "Binding = " &
> > > BindingString, vbLogEventTypeInformation, 0
> > >             NewBindings(i) = BindingString
> > >         Next
> > >
> > >         SiteObj.ServerBindings = NewBindings
> > >
> > >         SiteObj.SetInfo
> > >
> > >         If Err.Number <> 0 Then
> > >             UpdateSite = UpdateSite & vbCrLf & "Error on Setting up
> > > Hosts: " & Err.Description
> > >             Err.Clear
> > >         End If
> > >     End If
> > >
> > >
> > >
> >
> >
> >


Relevant Pages