Function CriaDiretorioVirtual(ByVal vdirname As String, ByVal serverID As String, ByVal vdirPath As String, ByVal criaApplication As Boolean) As DirectoryEntry<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Dim newvdir As DirectoryEntry
Dim root As DirectoryEntry
root = New DirectoryEntry("IIS://localhost/W3SVC/" + serverID + "/Root")
newvdir = root.Children.Add(vdirname, "IIsWebVirtualDir")
newvdir.Properties("Path")(0) = vdirPath
If criaApplication Then
newvdir.Invoke("AppCreate", True)
newvdir.Properties("AppFriendlyName")(0) = vdirname
newvdir.Properties("AppIsolated")(0) = 2
End If
newvdir.CommitChanges()
Return newvdir
End Function
博客展示了一段VB.NET代码,定义了一个名为CriaDiretorioVirtual的函数,用于在IIS中创建虚拟目录。函数接收目录名、服务器ID、目录路径和是否创建应用程序等参数,通过操作DirectoryEntry对象完成虚拟目录的创建和属性设置。
1610

被折叠的 条评论
为什么被折叠?



