![](/img/trans.png)
[英]How to remove IIS 6 web directory property using directoryentry in C#
[英]When you set a web directory property “AuthNTLM” using the DirectoryEntry object, what IIS setting are you actually changing?
我的任務是將我們的產品安裝程序從InstallShield遷移到WiX。
為了部署Web應用程序,以前的開發人員在InstallShield中使用了“自定義操作”(用C#編寫)。 在Wix中,這不再是必需的,因為wix支持IIS部署。
無論如何,“定制操作”中的代碼之一使用DirectoryEntry對象來設置Web目錄的屬性:
DirectoryEntry.Properties["AuthNTLM"][0] = true;
此設置有什么作用? 我知道它與安全性/權限有關,但是它實際上在IIS中設置了什么設置? 是否啟用以下功能之一:
謝謝!
前一段時間,我提供了一個類似問題的答案:
AuthFlags
(不是AuthNTLM
)是一個標志值。 您可以在不使用索引器的情況下進行設置,例如:
int MD_AUTH_ANONYMOUS = 1;
int MD_AUTH_BASIC = 2;
int MD_AUTH_NT = 4;
using(DirectoryEntry w3svc = new DirectoryEntry(@"IIS://Localhost/W3SVC"))
{
using(DirectoryEntry webSite = w3svc.Children.Add(iisNumber, "IIsWebServer"))
{
// Configure website settings here...
....
webSite.CommitChanges();
using(DirectoryEntry siteRoot = webSite.Children.Add("root",
IISSchemaClasses.IIsWebVirtualDir))
{
// Configure root application settings...
....
// Only allow Basic and NTLM authentication
siteRoot.Properties["AuthFlags"].Value = MD_AUTH_BASIC | MD_AUTH_NT
siteRoot.CommitChanges();
}
}
}
實際上,在InstallShield中也可能不需要它。 當前,InstallShield實際上比WiX具有更好的內置IIS支持,並且可以以聲明方式完成這種類型的設置,而無需編寫自定義操作。 同樣,收集此信息的InstallShield UI看起來與IIS MMC管理單元非常相似,因此可以直觀地看到數據的映射方式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.