DirectoryEntry.Properties[“路径”].Value.ToString(); IIS7问题。 C#
当前出现未知错误 (0x80005000)
- 运行以下代码时链接到 C# 中的“COM 异常” string virtualDirectory = GetVirtualDirPath("IIS://localhost", "1", reportUrl);
static string GetVirtualDirPath(string iisHost,
string siteName, string vdName)
{
string adsiPath = iisHost + "/W3SVC/" + siteName + "/Root/test/" + vdName;
try
{
DirectoryEntry entry = new DirectoryEntry(adsiPath);
return entry.Properties["Path"].Value.ToString();
}
catch (Exception ex)
{
// If Virtual Directory is not found,
// it will throw exception.
return "";
}
return "";
}
我已将“share”设置为“/test”内的虚拟目录(http://localhost/test /share)并尝试授予该文件夹相关权限。
我读到这仅适用于 IIS6 而不适用于 IIS7?如果是这样,等效代码是什么?
Currently getting Unknown error (0x80005000)
- Linked to "COM Exception" in C# when running the following codestring virtualDirectory = GetVirtualDirPath("IIS://localhost", "1", reportUrl);
static string GetVirtualDirPath(string iisHost,
string siteName, string vdName)
{
string adsiPath = iisHost + "/W3SVC/" + siteName + "/Root/test/" + vdName;
try
{
DirectoryEntry entry = new DirectoryEntry(adsiPath);
return entry.Properties["Path"].Value.ToString();
}
catch (Exception ex)
{
// If Virtual Directory is not found,
// it will throw exception.
return "";
}
return "";
}
I have setup "share" as a Virtual Directory inside "/test" (http://localhost/test/share) and tried giving that folder relevant permissions.
I have read that this only works in IIS6 and Not IIS7? If so, what is the equivalent code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IIS7现在公开了托管管理API,其信息可以是 在这里找到。
更具体地说,有一些类可以促进虚拟目录的管理。
IIS7 now exposes a managed management API, information of which can be found here.
More specifically, there are classes to facilitate management of virtual directories.