Hi
I am writing an application to automate my IIS administration script but I have been stuck in this problem for quiet sometime now I want to setup the Application Name in my IIS 6.0. I use the following script for website creation.
Dim w3svc As DirectoryEntry
w3svc = New DirectoryEntry("IIS://" & IISServer & "/W3SVC")
newsite = New Object() {ServerComment, IPPortHostName.ToArray(), DataFolderName}
websiteId = w3svc.Invoke("CreateNewSite", newsite)
w3svc.CommitChanges()
w3svc.RefreshCache()
w3svc.Close()
I use the following function to set website properties. The AppFriendlyName property does get set properly as I am able to retrieve it later on. but in IIS Management Console the "Application Name" Textbox remains empty... Whyyy
Public Sub SetWebSiteProperties(ByVal IISServer As String, ByVal WebsiteId As String, ByVal ApplicationName As String, ByVal LogInterval As String, ByVal ApplicationPool As String ByVal LimitBandwidth As String, ByVal ConnectionLimitedTo As String)
Try
Dim WebServerSchema As String = "IIsWebServer"
Dim Site As DirectoryEntry = New DirectoryEntry("IIS://" & IISServer & "/w3svc/" & WebsiteId)
If (Site.SchemaClassName = WebServerSchema) Then
Site.InvokeSet("AppFriendlyName", ApplicationName)
Site.Invoke("Put", "AccessRead", True)
Site.Invoke("Put", "AccessExecute", True)
Site.Invoke("Put", "MaxConnections", ConnectionLimitedTo)
Site.Invoke("Put", "LogFilePeriod", LogInterval)
Site.Invoke("Put", "MaxBandwidth", LimitBandwidth)
Site.Invoke("Put", "AppPoolId", ApplicationPool)
Site.CommitChanges()
Site.RefreshCache()
End If
Site.Close()
Catch Err As Exception
Throw
End Try
End Sub