IIS 7 and Vista - Some things from earlier OSs don"t appear to function properly in Vista...

IIS 7 and Vista - Some things from earlier OSs don"t appear to function properly in Vista...

am 28.08.2007 21:00:05 von Superfreak3

We have a web install that creates a virtual directory, etc. and edits
some config files. The installation is kicked off from a wrapper .exe
called autorun.exe. Installing as an Admin and allowing the
application to run at the UAC prompt, one of the first functions is to
detect if ASP.NET web extensions are installed/enabled. Here is the
code for that utility, again called from the wrapper...

'This will be conditioned in Browser/Wrapper to only run on Windows
Server OSs
'Create .txt files to be checked by Wrapper as conditions to
proceed....

Dim objFSO, AspMissing, AspDisabled, AspOther, fileRoot, fileText

Dim aWebSvcExtRestrictionList
Dim extension, sExt, Found

On Error Resume Next

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set fileRoot = objFSO.GetSpecialFolder(2)

If Right(fileRoot, 1) <> "\" Then
fileRoot = fileRoot & "\"
End If

AspMissing = fileRoot & "AspMissing.txt"
AspDisabled = fileRoot & "AspDisabled.txt"
AspOther = fileRoot & "AspOther.txt"

aWebSvcExtRestrictionList = Array()

Set IISWebServiceObj = GetObject("IIS://localhost/W3SVC")

' Store original value:
aWebSvcExtRestrictionList =
IISWebServiceObj.WebSvcExtRestrictionList

Found = 0
For extension = 0 To
UBound(IISWebServiceObj.WebSvcExtRestrictionList)
sExt = IISWebServiceObj.Get("WebSvcExtRestrictionList")
(extension)
If (0 < (InStr(sExt, "Microsoft.NET\Framework
\v2.0.50727\aspnet_isapi.dll"))) Then
Found = 1
If ("0" = Left(sExt, 1)) Then
'Create AspDisabled .txt file
Set fileText = objFSO.CreateTextFile(AspDisabled,
True)
ElseIf ("1" = Left(sExt, 1)) Then
'Clean Up....
'Delete AspDisabled .txt file if exists
If objFSO.FileExists(AspDisabled) Then
objFSO.DeleteFile AspDisabled
End If
'Delete AspOther .txt file
If objFSO.FileExists(AspOther) Then
objFS.DeleteFile AspOther
End If
'Delete AspMissing .txt file
If objFSO.FileExists(AspMissing) Then
objFSO.DeleteFile AspMissing
End If
Else
'Create AspOther .txt file
Set fileText = objFSO.CreateTextFile(AspOther, True)
End If
End If
Next

If Found = 0 Then
'Create AspMissing .txt file
Set fileText = objFSO.CreateTextFile(AspMissing, True)
Else
'Delete AspMissing .txt file if exists
If objFSO.FileExists(AspMissing) Then
objFS.DeleteFile AspMissing
End If
End If

End

Will this work in Vista or is IIS 7 different in that these functions
will not work properly. It seemed to create the missing .txt file. I
then added ASP.NET via 'Turn Windows features on or off'. When I run
the utility, it still creates the missing .txt file, but I was hoping
that the disabled version would be created. I guess I'm missing
something.

How would I go about adding/enabling the ASP.NET version 2.0 web
extension in IIS 7 on Vista? After doing so, would the above code
detect its existence and state properly?

In addition, we make a file edit of a third party config file
installed to Program Files\ThirdParty\bin\jetty\etc. What is supposed
to happen is the file is searched for a line containing a tag or
trigger of [ComputerName]. When found, IIS Header information is
supposed to be ascertained and an edit made based on the following
code:

Imports System.DirectoryServices
Imports System
Imports Microsoft.Win32


Public Class IISAdmin

Public Shared Sub GetWebsiteID(ByVal websiteName As String)
Dim w3svc As DirectoryEntry = New DirectoryEntry("IIS://
localhost/w3svc")

'On Error Resume Next
For Each de As DirectoryEntry In w3svc.Children
'Add OR de.Name = websiteName) because Wise writing Web
Site to AdeptExplorer.ini as site ID
'on Win 2K3 systems
If de.SchemaClassName = "IIsWebServer" AndAlso
(de.Properties("ServerComment")(0).ToString = websiteName Or de.Name =
websiteName) Then

'Edit Jetty Section
Dim site As DirectoryEntry = New DirectoryEntry("IIS://
localhost/w3svc/" + de.Name)
Dim strLine, _
strEdit, _
strServerName, _
strIPAddress, _
strProgs As String
Dim strBindings As String '= strIP + ":" + strPort +
":" + strHeader
Dim oReader As System.IO.StreamReader
Dim oWriter As System.IO.StreamWriter
Dim strReg As RegistryKey

strReg = Registry.LocalMachine.OpenSubKey("Software
\Synergis\AdeptExplorer\AutoVue", True)
strProgs = strReg.GetValue("Installation",
Environment.GetEnvironmentVariable("PROGRAMFILES"))

'strProgs =
Environment.GetEnvironmentVariable("PROGRAMFILES")

Try
Dim serverBindings As PropertyValueCollection =
site.Properties("ServerBindings")
'Grab the ServerBindings property
'de.Name needs to be replaced by an intIndex to
jump through serverBindings in
'For Next loop -> 0 to serverBindings.Count -1 if
cycling through items is needed.
'Else, parse and resolve first binding.
strBindings = serverBindings.Item(0)
'MsgBox(strBindings)


'Split the server bindings property into IP(0),
Port(1), Header(2)
Dim strArray() As String = strBindings.Split(":")

'Edit jetty.xml with connection information for
viewing


'Changes needed for AutoVue v19.2 - file seems to
be webdefault.xml
'changes other references throughout
'If System.IO.File.Exists(strProgs & "\jVue\bin
\jetty\etc\jetty.xml") Then
' oReader = System.IO.File.OpenText(strProgs &
"\jVue\bin\jetty\etc\jetty.xml")
' oWriter = System.IO.File.CreateText(strProgs
& "\jVue\bin\jetty\etc\jetty1.xml")

If System.IO.File.Exists(strProgs & "\jVue\bin
\jetty\etc\webdefault.xml") Then
oReader = System.IO.File.OpenText(strProgs &
"\jVue\bin\jetty\etc\webdefault.xml")
oWriter = System.IO.File.CreateText(strProgs &
"\jVue\bin\jetty\etc\webdefault1.xml")

While oReader.Peek <> -1
strLine = oReader.ReadLine()

If strLine = " http://
[ComputerName]/Adept7/Service_Adept
" Then
'Only check IP:PORT:HEADER info if
array index = 3???
If strArray.Length = 3 Then

If strArray(2) <> "" Then 'Use
Host Header for Edit
strEdit = strArray(2)
ElseIf strArray(0) <> "" Then 'Use
IP for Edit
strEdit = strArray(0)
Else 'Grab the system IP address
for Edit
strServerName =
System.Net.Dns.GetHostName()
'strIPAddress =
System.Net.Dns.GetHostByName(strServerName).AddressList(0).T oString()
'strEdit = strIPAddress
strEdit = strServerName
End If

If strArray(1) <> "80" Then
strEdit = strEdit & ":" &
strArray(1)
End If

Else
strServerName =
System.Net.Dns.GetHostName()
strEdit = strServerName
End If

strLine =
strLine.Replace("[ComputerName]", strEdit)
oWriter.WriteLine(strLine)
Else
oWriter.WriteLine(strLine)
End If
End While

oWriter.Close()
oReader.Close()

System.IO.File.Delete(strProgs & "\jVue\bin
\jetty\etc\webdefault.xml")
System.IO.File.Move(strProgs & "\jVue\bin\jetty
\etc\webdefault1.xml", strProgs & "\jVue\bin\jetty\etc
\webdefault.xml")

End If

Catch e As Exception
MessageBox.Show("There was a problem editing the
Synergis DMS section of " & strProgs & "\jVue\bin\jetty\etc
\jetty.xml. " & _
"The [ComputerName]" & vbCrLf &
"section of the following line needs to be adjusted for IP Address,
Port and or Host Header information: " & _
vbCrLf & vbCrLf & " value>http://[ComputerName]/Adept7/Service_Adept" &
vbCrLf & vbCrLf & "This will prevent document viewing if not
corrected.", "Viewer File Edit Problem!", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
End Try

End If
Next

End Sub

'Public Shared Sub Main()
'GetWebsiteID("Default Web Site")
'End Sub
End Class


I don't know if I'm having a problem with code handling changes in IIS
7 on Vista or if I'm having trouble getting information from the
registry in HKLM due to the locked down nature of Vista.

Any information or pointers to such would be GREATLY APPRECIATED!!

Re: IIS 7 and Vista - Some things from earlier OSs don"t appear to function properly in Vista...

am 29.08.2007 01:26:20 von David Wang

By default, IIS7 is pretty much incompatible with all existing web
setup programs because IIS7 has a totally new and incompatible
configuration system and API. Your code will not work without the
"IIS6 Metabase Compatibility" component installed.


FYI: Your setup code is pretty shaky. I can identify many problems and
misunderstandings within it. And its logic can be better accomplished
in about an order magnitude less code using either pure .Net or pure
Windows Script.

For example, I don't know why it doesn't just use iisext.vbs instead
of some custom code and managing three files. It assumes many things
about the system which makes it fragile. Also, XML makes it very easy
to do search and replace with an IIS ServerBinding with no fuss. If
someone uses semantically equivalent value of:
param-value>
Then your code will miss modifying it.


string xmlFileToModify = System.IO.Path.Combine(strProgs, "jVue\\bin\
\jetty\\etc\\jetty.xml");
string xmlToModify = "http://[ComputerName]/Adept7/Service_Adept";

System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.LoadXml(xmlFileToModify);
// Select all nodes that look like http://[ComputerName]/
Adept7/Service_Adept

System.Xml.XmlNodeList nodes = xmlDoc.SelectNodes("// value>[text()='"+ xmlToModify + "']");
foreach (System.Xml.Node node in nodes)
{
node.InnerText = node.InnerText.Replace("[ComputerName]",
strEdit);
}
xmlDoc.Save(xmlFileToModify);


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//




On Aug 28, 12:00 pm, Superfreak3 wrote:
> We have a web install that creates a virtual directory, etc. and edits
> some config files. The installation is kicked off from a wrapper .exe
> called autorun.exe. Installing as an Admin and allowing the
> application to run at the UAC prompt, one of the first functions is to
> detect if ASP.NET web extensions are installed/enabled. Here is the
> code for that utility, again called from the wrapper...
>
> 'This will be conditioned in Browser/Wrapper to only run on Windows
> Server OSs
> 'Create .txt files to be checked by Wrapper as conditions to
> proceed....
>
> Dim objFSO, AspMissing, AspDisabled, AspOther, fileRoot, fileText
>
> Dim aWebSvcExtRestrictionList
> Dim extension, sExt, Found
>
> On Error Resume Next
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
>
> Set fileRoot = objFSO.GetSpecialFolder(2)
>
> If Right(fileRoot, 1) <> "\" Then
> fileRoot = fileRoot & "\"
> End If
>
> AspMissing = fileRoot & "AspMissing.txt"
> AspDisabled = fileRoot & "AspDisabled.txt"
> AspOther = fileRoot & "AspOther.txt"
>
> aWebSvcExtRestrictionList = Array()
>
> Set IISWebServiceObj = GetObject("IIS://localhost/W3SVC")
>
> ' Store original value:
> aWebSvcExtRestrictionList =
> IISWebServiceObj.WebSvcExtRestrictionList
>
> Found = 0
> For extension = 0 To
> UBound(IISWebServiceObj.WebSvcExtRestrictionList)
> sExt = IISWebServiceObj.Get("WebSvcExtRestrictionList")
> (extension)
> If (0 < (InStr(sExt, "Microsoft.NET\Framework
> \v2.0.50727\aspnet_isapi.dll"))) Then
> Found = 1
> If ("0" = Left(sExt, 1)) Then
> 'Create AspDisabled .txt file
> Set fileText = objFSO.CreateTextFile(AspDisabled,
> True)
> ElseIf ("1" = Left(sExt, 1)) Then
> 'Clean Up....
> 'Delete AspDisabled .txt file if exists
> If objFSO.FileExists(AspDisabled) Then
> objFSO.DeleteFile AspDisabled
> End If
> 'Delete AspOther .txt file
> If objFSO.FileExists(AspOther) Then
> objFS.DeleteFile AspOther
> End If
> 'Delete AspMissing .txt file
> If objFSO.FileExists(AspMissing) Then
> objFSO.DeleteFile AspMissing
> End If
> Else
> 'Create AspOther .txt file
> Set fileText = objFSO.CreateTextFile(AspOther, True)
> End If
> End If
> Next
>
> If Found = 0 Then
> 'Create AspMissing .txt file
> Set fileText = objFSO.CreateTextFile(AspMissing, True)
> Else
> 'Delete AspMissing .txt file if exists
> If objFSO.FileExists(AspMissing) Then
> objFS.DeleteFile AspMissing
> End If
> End If
>
> End
>
> Will this work in Vista or is IIS 7 different in that these functions
> will not work properly. It seemed to create the missing .txt file. I
> then added ASP.NET via 'Turn Windows features on or off'. When I run
> the utility, it still creates the missing .txt file, but I was hoping
> that the disabled version would be created. I guess I'm missing
> something.
>
> How would I go about adding/enabling the ASP.NET version 2.0 web
> extension in IIS 7 on Vista? After doing so, would the above code
> detect its existence and state properly?
>
> In addition, we make a file edit of a third party config file
> installed to Program Files\ThirdParty\bin\jetty\etc. What is supposed
> to happen is the file is searched for a line containing a tag or
> trigger of [ComputerName]. When found, IIS Header information is
> supposed to be ascertained and an edit made based on the following
> code:
>
> Imports System.DirectoryServices
> Imports System
> Imports Microsoft.Win32
>
> Public Class IISAdmin
>
> Public Shared Sub GetWebsiteID(ByVal websiteName As String)
> Dim w3svc As DirectoryEntry = New DirectoryEntry("IIS://
> localhost/w3svc")
>
> 'On Error Resume Next
> For Each de As DirectoryEntry In w3svc.Children
> 'Add OR de.Name = websiteName) because Wise writing Web
> Site to AdeptExplorer.ini as site ID
> 'on Win 2K3 systems
> If de.SchemaClassName = "IIsWebServer" AndAlso
> (de.Properties("ServerComment")(0).ToString = websiteName Or de.Name =
> websiteName) Then
>
> 'Edit Jetty Section
> Dim site As DirectoryEntry = New DirectoryEntry("IIS://
> localhost/w3svc/" + de.Name)
> Dim strLine, _
> strEdit, _
> strServerName, _
> strIPAddress, _
> strProgs As String
> Dim strBindings As String '= strIP + ":" + strPort +
> ":" + strHeader
> Dim oReader As System.IO.StreamReader
> Dim oWriter As System.IO.StreamWriter
> Dim strReg As RegistryKey
>
> strReg = Registry.LocalMachine.OpenSubKey("Software
> \Synergis\AdeptExplorer\AutoVue", True)
> strProgs = strReg.GetValue("Installation",
> Environment.GetEnvironmentVariable("PROGRAMFILES"))
>
> 'strProgs =
> Environment.GetEnvironmentVariable("PROGRAMFILES")
>
> Try
> Dim serverBindings As PropertyValueCollection =
> site.Properties("ServerBindings")
> 'Grab the ServerBindings property
> 'de.Name needs to be replaced by an intIndex to
> jump through serverBindings in
> 'For Next loop -> 0 to serverBindings.Count -1 if
> cycling through items is needed.
> 'Else, parse and resolve first binding.
> strBindings = serverBindings.Item(0)
> 'MsgBox(strBindings)
>
> 'Split the server bindings property into IP(0),
> Port(1), Header(2)
> Dim strArray() As String = strBindings.Split(":")
>
> 'Edit jetty.xml with connection information for
> viewing
>
> 'Changes needed for AutoVue v19.2 - file seems to
> be webdefault.xml
> 'changes other references throughout
> 'If System.IO.File.Exists(strProgs & "\jVue\bin
> \jetty\etc\jetty.xml") Then
> ' oReader = System.IO.File.OpenText(strProgs &
> "\jVue\bin\jetty\etc\jetty.xml")
> ' oWriter = System.IO.File.CreateText(strProgs
> & "\jVue\bin\jetty\etc\jetty1.xml")
>
> If System.IO.File.Exists(strProgs & "\jVue\bin
> \jetty\etc\webdefault.xml") Then
> oReader = System.IO.File.OpenText(strProgs &
> "\jVue\bin\jetty\etc\webdefault.xml")
> oWriter = System.IO.File.CreateText(strProgs &
> "\jVue\bin\jetty\etc\webdefault1.xml")
>
> While oReader.Peek <> -1
> strLine = oReader.ReadLine()
>
> If strLine = " http://
> [ComputerName]/Adept7/Service_Adept
" Then
> 'Only check IP:PORT:HEADER info if
> array index = 3???
> If strArray.Length = 3 Then
>
> If strArray(2) <> "" Then 'Use
> Host Header for Edit
> strEdit = strArray(2)
> ElseIf strArray(0) <> "" Then 'Use
> IP for Edit
> strEdit = strArray(0)
> Else 'Grab the system IP address
> for Edit
> strServerName =
> System.Net.Dns.GetHostName()
> 'strIPAddress =
> System.Net.Dns.GetHostByName(strServerName).AddressList(0).T oString()
> 'strEdit = strIPAddress
> strEdit = strServerName
> End If
>
> If strArray(1) <> "80" Then
> strEdit = strEdit & ":" &
> strArray(1)
> End If
>
> Else
> strServerName =
> System.Net.Dns.GetHostName()
> strEdit = strServerName
> End If
>
> strLine =
> strLine.Replace("[ComputerName]", strEdit)
> oWriter.WriteLine(strLine)
> Else
> oWriter.WriteLine(strLine)
> End If
> End While
>
> oWriter.Close()
> oReader.Close()
>
> System.IO.File.Delete(strProgs & "\jVue\bin
> \jetty\etc\webdefault.xml")
> System.IO.File.Move(strProgs & "\jVue\bin\jetty
> \etc\webdefault1.xml", strProgs & "\jVue\bin\jetty\etc
> \webdefault.xml")
>
> End If
>
> Catch e As Exception
> MessageBox.Show("There was a problem editing the
> Synergis DMS section of " & strProgs & "\jVue\bin\jetty\etc
> \jetty.xml. " & _
> "The [ComputerName]" & vbCrLf &
> "section of the following line needs to be adjusted for IP Address,
> Port and or Host Header information: " & _
> vbCrLf & vbCrLf & " > value>http://[ComputerName]/Adept7/Service_Adept
" &
> vbCrLf & vbCrLf & "This will prevent document viewing if not
> corrected.", "Viewer File Edit Problem!", MessageBoxButtons.OK,
> MessageBoxIcon.Exclamation)
> End Try
>
> End If
> Next
>
> End Sub
>
> 'Public Shared Sub Main()
> 'GetWebsiteID("Default Web Site")
> 'End Sub
> End Class
>
> I don't know if I'm having a problem with code handling changes in IIS
> 7 on Vista or if I'm having trouble getting information from the
> registry in HKLM due to the locked down nature of Vista.
>
> Any information or pointers to such would be GREATLY APPRECIATED!!

Re: IIS 7 and Vista - Some things from earlier OSs don"t appear to function properly in Vista...

am 30.08.2007 14:57:52 von Superfreak3

On Aug 28, 7:26 pm, David Wang wrote:
> By default, IIS7 is pretty much incompatible with all existing web
> setup programs because IIS7 has a totally new and incompatible
> configuration system and API. Your code will not work without the
> "IIS6 Metabase Compatibility" component installed.
>
> FYI: Your setup code is pretty shaky. I can identify many problems and
> misunderstandings within it. And its logic can be better accomplished
> in about an order magnitude less code using either pure .Net or pure
> Windows Script.
>
> For example, I don't know why it doesn't just use iisext.vbs instead
> of some custom code and managing three files. It assumes many things
> about the system which makes it fragile. Also, XML makes it very easy
> to do search and replace with an IIS ServerBinding with no fuss. If
> someone uses semantically equivalent value of:
> > param-value>
> Then your code will miss modifying it.
>
> string xmlFileToModify =3D System.IO.Path.Combine(strProgs, "jVue\\bin\
> \jetty\\etc\\jetty.xml");
> string xmlToModify =3D "http://[ComputerName]/Adept7/Service_Adept";
>
> System.Xml.XmlDocument xmlDoc =3D new System.Xml.XmlDocument();
> xmlDoc.LoadXml(xmlFileToModify);// Select all nodes that look like -value>http://[ComputerName]/
> Adept7/Service_Adept

> System.Xml.XmlNodeList nodes =3D xmlDoc.SelectNodes("// > value>[text()=3D'"+ xmlToModify + "']");
> foreach (System.Xml.Node node in nodes)
> {
> node.InnerText =3D node.InnerText.Replace("[ComputerName]",
> strEdit);}
>
> xmlDoc.Save(xmlFileToModify);
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David. Wang
> //
>
> On Aug 28, 12:00 pm, Superfreak3 wrote:
>
>
>
> > We have a web install that creates a virtual directory, etc. and edits
> > some config files. The installation is kicked off from a wrapper .exe
> > called autorun.exe. Installing as an Admin and allowing the
> > application to run at the UAC prompt, one of the first functions is to
> > detect if ASP.NET web extensions are installed/enabled. Here is the
> > code for that utility, again called from the wrapper...
>
> > 'This will be conditioned in Browser/Wrapper to only run on Windows
> > Server OSs
> > 'Create .txt files to be checked by Wrapper as conditions to
> > proceed....
>
> > Dim objFSO, AspMissing, AspDisabled, AspOther, fileRoot, fileText
>
> > Dim aWebSvcExtRestrictionList
> > Dim extension, sExt, Found
>
> > On Error Resume Next
>
> > Set objFSO =3D CreateObject("Scripting.FileSystemObject")
>
> > Set fileRoot =3D objFSO.GetSpecialFolder(2)
>
> > If Right(fileRoot, 1) <> "\" Then
> > fileRoot =3D fileRoot & "\"
> > End If
>
> > AspMissing =3D fileRoot & "AspMissing.txt"
> > AspDisabled =3D fileRoot & "AspDisabled.txt"
> > AspOther =3D fileRoot & "AspOther.txt"
>
> > aWebSvcExtRestrictionList =3D Array()
>
> > Set IISWebServiceObj =3D GetObject("IIS://localhost/W3SVC")
>
> > ' Store original value:
> > aWebSvcExtRestrictionList =3D
> > IISWebServiceObj.WebSvcExtRestrictionList
>
> > Found =3D 0
> > For extension =3D 0 To
> > UBound(IISWebServiceObj.WebSvcExtRestrictionList)
> > sExt =3D IISWebServiceObj.Get("WebSvcExtRestrictionList")
> > (extension)
> > If (0 < (InStr(sExt, "Microsoft.NET\Framework
> > \v2.0.50727\aspnet_isapi.dll"))) Then
> > Found =3D 1
> > If ("0" =3D Left(sExt, 1)) Then
> > 'Create AspDisabled .txt file
> > Set fileText =3D objFSO.CreateTextFile(AspDisabled,
> > True)
> > ElseIf ("1" =3D Left(sExt, 1)) Then
> > 'Clean Up....
> > 'Delete AspDisabled .txt file if exists
> > If objFSO.FileExists(AspDisabled) Then
> > objFSO.DeleteFile AspDisabled
> > End If
> > 'Delete AspOther .txt file
> > If objFSO.FileExists(AspOther) Then
> > objFS.DeleteFile AspOther
> > End If
> > 'Delete AspMissing .txt file
> > If objFSO.FileExists(AspMissing) Then
> > objFSO.DeleteFile AspMissing
> > End If
> > Else
> > 'Create AspOther .txt file
> > Set fileText =3D objFSO.CreateTextFile(AspOther, True)
> > End If
> > End If
> > Next
>
> > If Found =3D 0 Then
> > 'Create AspMissing .txt file
> > Set fileText =3D objFSO.CreateTextFile(AspMissing, True)
> > Else
> > 'Delete AspMissing .txt file if exists
> > If objFSO.FileExists(AspMissing) Then
> > objFS.DeleteFile AspMissing
> > End If
> > End If
>
> > End
>
> > Will this work in Vista or is IIS 7 different in that these functions
> > will not work properly. It seemed to create the missing .txt file. I
> > then added ASP.NET via 'Turn Windows features on or off'. When I run
> > the utility, it still creates the missing .txt file, but I was hoping
> > that the disabled version would be created. I guess I'm missing
> > something.
>
> > How would I go about adding/enabling the ASP.NET version 2.0 web
> > extension in IIS 7 on Vista? After doing so, would the above code
> > detect its existence and state properly?
>
> > In addition, we make a file edit of a third party config file
> > installed to Program Files\ThirdParty\bin\jetty\etc. What is supposed
> > to happen is the file is searched for a line containing a tag or
> > trigger of [ComputerName]. When found, IIS Header information is
> > supposed to be ascertained and an edit made based on the following
> > code:
>
> > Imports System.DirectoryServices
> > Imports System
> > Imports Microsoft.Win32
>
> > Public Class IISAdmin
>
> > Public Shared Sub GetWebsiteID(ByVal websiteName As String)
> > Dim w3svc As DirectoryEntry =3D New DirectoryEntry("IIS://
> > localhost/w3svc")
>
> > 'On Error Resume Next
> > For Each de As DirectoryEntry In w3svc.Children
> > 'Add OR de.Name =3D websiteName) because Wise writing Web
> > Site to AdeptExplorer.ini as site ID
> > 'on Win 2K3 systems
> > If de.SchemaClassName =3D "IIsWebServer" AndAlso
> > (de.Properties("ServerComment")(0).ToString =3D websiteName Or de.Name =
=3D
> > websiteName) Then
>
> > 'Edit Jetty Section
> > Dim site As DirectoryEntry =3D New DirectoryEntry("IIS:=
//
> > localhost/w3svc/" + de.Name)
> > Dim strLine, _
> > strEdit, _
> > strServerName, _
> > strIPAddress, _
> > strProgs As String
> > Dim strBindings As String '=3D strIP + ":" + strPort +
> > ":" + strHeader
> > Dim oReader As System.IO.StreamReader
> > Dim oWriter As System.IO.StreamWriter
> > Dim strReg As RegistryKey
>
> > strReg =3D Registry.LocalMachine.OpenSubKey("Software
> > \Synergis\AdeptExplorer\AutoVue", True)
> > strProgs =3D strReg.GetValue("Installation",
> > Environment.GetEnvironmentVariable("PROGRAMFILES"))
>
> > 'strProgs =3D
> > Environment.GetEnvironmentVariable("PROGRAMFILES")
>
> > Try
> > Dim serverBindings As PropertyValueCollection =3D
> > site.Properties("ServerBindings")
> > 'Grab the ServerBindings property
> > 'de.Name needs to be replaced by an intIndex to
> > jump through serverBindings in
> > 'For Next loop -> 0 to serverBindings.Count -1 if
> > cycling through items is needed.
> > 'Else, parse and resolve first binding.
> > strBindings =3D serverBindings.Item(0)
> > 'MsgBox(strBindings)
>
> > 'Split the server bindings property into IP(0),
> > Port(1), Header(2)
> > Dim strArray() As String =3D strBindings.Split(":")
>
> > 'Edit jetty.xml with connection information for
> > viewing
>
> > 'Changes needed for AutoVue v19.2 - file seems to
> > be webdefault.xml
> > 'changes other references throughout
> > 'If System.IO.File.Exists(strProgs & "\jVue\bin
> > \jetty\etc\jetty.xml") Then
> > ' oReader =3D System.IO.File.OpenText(strProgs &
> > "\jVue\bin\jetty\etc\jetty.xml")
> > ' oWriter =3D System.IO.File.CreateText(strProgs
> > & "\jVue\bin\jetty\etc\jetty1.xml")
>
> > If System.IO.File.Exists(strProgs & "\jVue\bin
> > \jetty\etc\webdefault.xml") Then
> > oReader =3D System.IO.File.OpenText(strProgs &
> > "\jVue\bin\jetty\etc\webdefault.xml")
> > oWriter =3D System.IO.File.CreateText(strProgs &
> > "\jVue\bin\jetty\etc\webdefault1.xml")
>
> > While oReader.Peek <> -1
> > strLine =3D oReader.ReadLine()
>
> > If strLine =3D " http://
> > [ComputerName]/Adept7/Service_Adept
" Then
> > 'Only check IP:PORT:HEADER info if
> > array index =3D 3???
> > If strArray.Length =3D 3 Then
>
> > If strArray(2) <> "" Then 'Use
> > Host Header for Edit
> > strEdit =3D strArray(2)
> > ElseIf strArray(0) <> "" Then 'Use
> > IP for Edit
> > strEdit =3D strArray(0)
> > Else 'Grab the system IP address
> > for Edit
> > strServerName =3D
> > System.Net.Dns.GetHostName()
> > 'strIPAddress =3D
> > System.Net.Dns.GetHostByName(strServerName).AddressList(0).T oString()
> > 'strEdit =3D strIPAddress
> > strEdit =3D strServerName
> > End If
>
> > If strArray(1) <> "80" Then
> > strEdit =3D strEdit & ":" &
> > strArray(1)
>
> ...
>
> read more =BB- Hide quoted text -
>
> - Show quoted text -

Yeah, I'm pretty much a hack coder and put stuff together based on
information I received through posts and other web research. The
stuff worked for us on pre-Vista & IIS 7 so I WAS happy. Now I guess
I have to start the whole process again.

When you say...

"By default, IIS7 is pretty much incompatible with all existing web
setup programs because IIS7 has a totally new and incompatible
configuration system and API. Your code will not work without the
"IIS6 Metabase Compatibility" component installed."

...how is this accomplished (installing the IIS6 Metabase
Compatibility component)? If this is installed on a machine using IIS
7, does it have any detrimental effects?

Any further information is GREATLY APPRECIATED!

THANKS FOR THE 'STUFF' PROVIDED SO FAR!!!

Re: IIS 7 and Vista - Some things from earlier OSs don"t appear to function properly in Vista...

am 30.08.2007 15:01:06 von Superfreak3

On Aug 28, 7:26 pm, David Wang wrote:
> By default, IIS7 is pretty much incompatible with all existing web
> setup programs because IIS7 has a totally new and incompatible
> configuration system and API. Your code will not work without the
> "IIS6 Metabase Compatibility" component installed.
>
> FYI: Your setup code is pretty shaky. I can identify many problems and
> misunderstandings within it. And its logic can be better accomplished
> in about an order magnitude less code using either pure .Net or pure
> Windows Script.
>
> For example, I don't know why it doesn't just use iisext.vbs instead
> of some custom code and managing three files. It assumes many things
> about the system which makes it fragile. Also, XML makes it very easy
> to do search and replace with an IIS ServerBinding with no fuss. If
> someone uses semantically equivalent value of:
> > param-value>
> Then your code will miss modifying it.
>
> string xmlFileToModify =3D System.IO.Path.Combine(strProgs, "jVue\\bin\
> \jetty\\etc\\jetty.xml");
> string xmlToModify =3D "http://[ComputerName]/Adept7/Service_Adept";
>
> System.Xml.XmlDocument xmlDoc =3D new System.Xml.XmlDocument();
> xmlDoc.LoadXml(xmlFileToModify);// Select all nodes that look like -value>http://[ComputerName]/
> Adept7/Service_Adept

> System.Xml.XmlNodeList nodes =3D xmlDoc.SelectNodes("// > value>[text()=3D'"+ xmlToModify + "']");
> foreach (System.Xml.Node node in nodes)
> {
> node.InnerText =3D node.InnerText.Replace("[ComputerName]",
> strEdit);}
>
> xmlDoc.Save(xmlFileToModify);
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David. Wang
> //
>
> On Aug 28, 12:00 pm, Superfreak3 wrote:
>
>
>
> > We have a web install that creates a virtual directory, etc. and edits
> > some config files. The installation is kicked off from a wrapper .exe
> > called autorun.exe. Installing as an Admin and allowing the
> > application to run at the UAC prompt, one of the first functions is to
> > detect if ASP.NET web extensions are installed/enabled. Here is the
> > code for that utility, again called from the wrapper...
>
> > 'This will be conditioned in Browser/Wrapper to only run on Windows
> > Server OSs
> > 'Create .txt files to be checked by Wrapper as conditions to
> > proceed....
>
> > Dim objFSO, AspMissing, AspDisabled, AspOther, fileRoot, fileText
>
> > Dim aWebSvcExtRestrictionList
> > Dim extension, sExt, Found
>
> > On Error Resume Next
>
> > Set objFSO =3D CreateObject("Scripting.FileSystemObject")
>
> > Set fileRoot =3D objFSO.GetSpecialFolder(2)
>
> > If Right(fileRoot, 1) <> "\" Then
> > fileRoot =3D fileRoot & "\"
> > End If
>
> > AspMissing =3D fileRoot & "AspMissing.txt"
> > AspDisabled =3D fileRoot & "AspDisabled.txt"
> > AspOther =3D fileRoot & "AspOther.txt"
>
> > aWebSvcExtRestrictionList =3D Array()
>
> > Set IISWebServiceObj =3D GetObject("IIS://localhost/W3SVC")
>
> > ' Store original value:
> > aWebSvcExtRestrictionList =3D
> > IISWebServiceObj.WebSvcExtRestrictionList
>
> > Found =3D 0
> > For extension =3D 0 To
> > UBound(IISWebServiceObj.WebSvcExtRestrictionList)
> > sExt =3D IISWebServiceObj.Get("WebSvcExtRestrictionList")
> > (extension)
> > If (0 < (InStr(sExt, "Microsoft.NET\Framework
> > \v2.0.50727\aspnet_isapi.dll"))) Then
> > Found =3D 1
> > If ("0" =3D Left(sExt, 1)) Then
> > 'Create AspDisabled .txt file
> > Set fileText =3D objFSO.CreateTextFile(AspDisabled,
> > True)
> > ElseIf ("1" =3D Left(sExt, 1)) Then
> > 'Clean Up....
> > 'Delete AspDisabled .txt file if exists
> > If objFSO.FileExists(AspDisabled) Then
> > objFSO.DeleteFile AspDisabled
> > End If
> > 'Delete AspOther .txt file
> > If objFSO.FileExists(AspOther) Then
> > objFS.DeleteFile AspOther
> > End If
> > 'Delete AspMissing .txt file
> > If objFSO.FileExists(AspMissing) Then
> > objFSO.DeleteFile AspMissing
> > End If
> > Else
> > 'Create AspOther .txt file
> > Set fileText =3D objFSO.CreateTextFile(AspOther, True)
> > End If
> > End If
> > Next
>
> > If Found =3D 0 Then
> > 'Create AspMissing .txt file
> > Set fileText =3D objFSO.CreateTextFile(AspMissing, True)
> > Else
> > 'Delete AspMissing .txt file if exists
> > If objFSO.FileExists(AspMissing) Then
> > objFS.DeleteFile AspMissing
> > End If
> > End If
>
> > End
>
> > Will this work in Vista or is IIS 7 different in that these functions
> > will not work properly. It seemed to create the missing .txt file. I
> > then added ASP.NET via 'Turn Windows features on or off'. When I run
> > the utility, it still creates the missing .txt file, but I was hoping
> > that the disabled version would be created. I guess I'm missing
> > something.
>
> > How would I go about adding/enabling the ASP.NET version 2.0 web
> > extension in IIS 7 on Vista? After doing so, would the above code
> > detect its existence and state properly?
>
> > In addition, we make a file edit of a third party config file
> > installed to Program Files\ThirdParty\bin\jetty\etc. What is supposed
> > to happen is the file is searched for a line containing a tag or
> > trigger of [ComputerName]. When found, IIS Header information is
> > supposed to be ascertained and an edit made based on the following
> > code:
>
> > Imports System.DirectoryServices
> > Imports System
> > Imports Microsoft.Win32
>
> > Public Class IISAdmin
>
> > Public Shared Sub GetWebsiteID(ByVal websiteName As String)
> > Dim w3svc As DirectoryEntry =3D New DirectoryEntry("IIS://
> > localhost/w3svc")
>
> > 'On Error Resume Next
> > For Each de As DirectoryEntry In w3svc.Children
> > 'Add OR de.Name =3D websiteName) because Wise writing Web
> > Site to AdeptExplorer.ini as site ID
> > 'on Win 2K3 systems
> > If de.SchemaClassName =3D "IIsWebServer" AndAlso
> > (de.Properties("ServerComment")(0).ToString =3D websiteName Or de.Name =
=3D
> > websiteName) Then
>
> > 'Edit Jetty Section
> > Dim site As DirectoryEntry =3D New DirectoryEntry("IIS:=
//
> > localhost/w3svc/" + de.Name)
> > Dim strLine, _
> > strEdit, _
> > strServerName, _
> > strIPAddress, _
> > strProgs As String
> > Dim strBindings As String '=3D strIP + ":" + strPort +
> > ":" + strHeader
> > Dim oReader As System.IO.StreamReader
> > Dim oWriter As System.IO.StreamWriter
> > Dim strReg As RegistryKey
>
> > strReg =3D Registry.LocalMachine.OpenSubKey("Software
> > \Synergis\AdeptExplorer\AutoVue", True)
> > strProgs =3D strReg.GetValue("Installation",
> > Environment.GetEnvironmentVariable("PROGRAMFILES"))
>
> > 'strProgs =3D
> > Environment.GetEnvironmentVariable("PROGRAMFILES")
>
> > Try
> > Dim serverBindings As PropertyValueCollection =3D
> > site.Properties("ServerBindings")
> > 'Grab the ServerBindings property
> > 'de.Name needs to be replaced by an intIndex to
> > jump through serverBindings in
> > 'For Next loop -> 0 to serverBindings.Count -1 if
> > cycling through items is needed.
> > 'Else, parse and resolve first binding.
> > strBindings =3D serverBindings.Item(0)
> > 'MsgBox(strBindings)
>
> > 'Split the server bindings property into IP(0),
> > Port(1), Header(2)
> > Dim strArray() As String =3D strBindings.Split(":")
>
> > 'Edit jetty.xml with connection information for
> > viewing
>
> > 'Changes needed for AutoVue v19.2 - file seems to
> > be webdefault.xml
> > 'changes other references throughout
> > 'If System.IO.File.Exists(strProgs & "\jVue\bin
> > \jetty\etc\jetty.xml") Then
> > ' oReader =3D System.IO.File.OpenText(strProgs &
> > "\jVue\bin\jetty\etc\jetty.xml")
> > ' oWriter =3D System.IO.File.CreateText(strProgs
> > & "\jVue\bin\jetty\etc\jetty1.xml")
>
> > If System.IO.File.Exists(strProgs & "\jVue\bin
> > \jetty\etc\webdefault.xml") Then
> > oReader =3D System.IO.File.OpenText(strProgs &
> > "\jVue\bin\jetty\etc\webdefault.xml")
> > oWriter =3D System.IO.File.CreateText(strProgs &
> > "\jVue\bin\jetty\etc\webdefault1.xml")
>
> > While oReader.Peek <> -1
> > strLine =3D oReader.ReadLine()
>
> > If strLine =3D " http://
> > [ComputerName]/Adept7/Service_Adept
" Then
> > 'Only check IP:PORT:HEADER info if
> > array index =3D 3???
> > If strArray.Length =3D 3 Then
>
> > If strArray(2) <> "" Then 'Use
> > Host Header for Edit
> > strEdit =3D strArray(2)
> > ElseIf strArray(0) <> "" Then 'Use
> > IP for Edit
> > strEdit =3D strArray(0)
> > Else 'Grab the system IP address
> > for Edit
> > strServerName =3D
> > System.Net.Dns.GetHostName()
> > 'strIPAddress =3D
> > System.Net.Dns.GetHostByName(strServerName).AddressList(0).T oString()
> > 'strEdit =3D strIPAddress
> > strEdit =3D strServerName
> > End If
>
> > If strArray(1) <> "80" Then
> > strEdit =3D strEdit & ":" &
> > strArray(1)
>
> ...
>
> read more =BB- Hide quoted text -
>
> - Show quoted text -

Yeah, I'm pretty much a hack coder and put stuff together based on
information I received through posts and other web research. The
stuff worked for us on pre-Vista & IIS 7 so I WAS happy. Now I guess
I have to start the whole process again.

When you say...

"By default, IIS7 is pretty much incompatible with all existing web
setup programs because IIS7 has a totally new and incompatible
configuration system and API. Your code will not work without the
"IIS6 Metabase Compatibility" component installed."

...how is this accomplished (installing the IIS6 Metabase
Compatibility component)? If this is installed on a machine using IIS
7, does it have any detrimental effects?

Any further information is GREATLY APPRECIATED!