1
我可以在下面顯示的代碼中使用Microsoft.Web.Administration dll很容易地在IIS7中創建一個虛擬目錄,但我一直在拉我的頭髮試圖找出如何在虛擬目錄創建後給「網絡服務」寫入權限。任何人都可以將我指向正確的方向嗎?Microsoft.Web.Administration VirtualDirectory權限
Private Sub CreateVirDir(ByVal WebSite As String, ByVal AppPath As String, ByVal VirPath As String, ByVal DirPath As String)
Dim sm As New Microsoft.Web.Administration.ServerManager()
Dim cpapp As Microsoft.Web.Administration.Application = sm.Sites(WebSite).Applications(AppPath)
cpapp.VirtualDirectories.Add(VirPath, DirPath)
sm.CommitChanges()
End Sub