|
|
小胡子的大葱 · 发送包含工作项的电子邮件 - Azure ...· 11 月前 · |
|
|
快乐的卤蛋 · 快速创建第一个 opencv.js 项目 ...· 1 年前 · |
|
|
才高八斗的移动电源 · SWIG 扩展Opencv ...· 2 年前 · |
<webdav>
元素包含为 Internet Information Services (IIS) 7 配置 Web 分布式创作和版本管理 (WebDAV) 的设置。 WebDAV 是基于 Internet 的开放标准,支持通过 HTTP 和 HTTPS 连接编辑网站。 与文件传输协议 (FTP) 相比,WebDAV 具有多项优势,最显著的优势是提供更多安全选项,并且可使用单一 TCP 端口进行所有通信。
WebDAV 7.0 和 WebDAV 7.5 模块是 IIS 7.0 带外提供的,需要从以下 URL 下载和安装模块:
https://www.iis.net/expand/WebDAV
在 Windows 7 和 Windows Server 2008 R2 中,WebDAV 7.5 模块作为 IIS 7.5 的功能提供,因此无需再下载 WebDAV。
要在 Web 服务器中支持 WebDAV 发布,必须安装 WebDAV 模块。 为此,请按照以下步骤操作。
从以下 URL 下载安装包:
按照以下演练中的说明安装 WebDAV 模块:
打开 Internet Information Services (IIS) 管理器:
如果使用的是 Windows Server 2012 或 Windows Server 2012 R2:
如果使用的是 Windows 8 或 Windows 8.1:
如果使用的是 Windows Server 2008 或 Windows Server 2008 R2:
如果使用的是 Windows Vista 或 Windows 7:
打开 Internet Information Services (IIS) 管理器:
如果使用的是 Windows Server 2012 或 Windows Server 2012 R2:
如果使用的是 Windows 8 或 Windows 8.1:
如果使用的是 Windows Server 2008 或 Windows Server 2008 R2:
如果使用的是 Windows Vista 或 Windows 7:
在 ApplicationHost.config 文件中,可在全局、站点和目录级别配置
<webdav>
元素。 Web.config 文件中的 WebDAV 设置将被忽略。
以下示例列出了默认网站的示例
<webdav>
元素。 此示例清除所有现有创作规则,为管理员组添加一条规则,启用 WebDAV 创作,指定允许隐藏文件,启用 WebDAV 锁并指定锁提供程序,同时启用 WebDAV 属性并指定属性映射的默认 XML 命名空间。
<location path="Default Web Site">
<system.webServer>
<webdav>
<authoringRules defaultAccess="none" allowNonMimeMapFiles="true" defaultMimeType="text/plain">
<clear />
<add roles="administrators" path="*" access="Read, Write, Source" />
</authoringRules>
<authoring enabled="true" requireSsl="false">
<fileSystem allowHiddenFiles="true" />
<locks enabled="true" lockStore="webdav_simple_lock" requireLockForWriting="false" />
<properties allowAnonymousPropfind="false" allowInfinitePropfindDepth="false" allowCustomProperties="true">
<clear />
<add xmlNamespace="*" propertyStore="webdav_simple_prop" />
</properties>
</authoring>
</webdav>
</system.webServer>
</location>
以下示例列出了 WebDAV 服务器的示例 <globalSettings> 元素。 此示例定义锁和属性的内置简单提供程序,并为服务器启用 WebDAV 锁。
<system.webServer>
<webdav>
<globalSettings>
<propertyStores>
<add name="webdav_simple_prop" image="%windir%\system32\inetsrv\webdav_simple_prop.dll" />
</propertyStores>
<lockStores>
<add name="webdav_simple_lock" image="%windir%\system32\inetsrv\webdav_simple_lock.dll" />
</lockStores>
</globalSettings>
<authoring>
<locks enabled="true" lockStore="webdav_simple_lock" />
</authoring>
</webdav>
</system.webServer>
以下示例为默认网站启用 WebDAV 创作,并配置该网站,使 WebDAV 创作不需要 SSL。
AppCmd.exe
appcmd.exe set config "Default Web Site" -section:system.webServer/webdav/authoring /enabled:"True" /requireSsl:"False" /commit:apphost
使用 AppCmd.exe 配置这些设置时,必须确保将 commit 参数设置为 apphost。 这会将配置设置提交到 ApplicationHost.config 文件中的相应位置部分。
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
private static void Main()
using (ServerManager serverManager = new ServerManager())
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection authoringSection = config.GetSection("system.webServer/webdav/authoring", "Default Web Site");
authoringSection["enabled"] = true;
authoringSection["requireSsl"] = false;
serverManager.CommitChanges();
VB.NET
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetApplicationHostConfiguration
Dim authoringSection As ConfigurationSection = config.GetSection("system.webServer/webdav/authoring", "Default Web Site")
authoringSection("enabled") = True
authoringSection("requireSsl") = False
serverManager.CommitChanges()
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var authoringSection = adminManager.GetAdminSection("system.webServer/webdav/authoring", "MACHINE/WEBROOT/APPHOST/Default Web Site");
authoringSection.Properties.Item("enabled").Value = true;
authoringSection.Properties.Item("requireSsl").Value = false;
adminManager.CommitChanges();
VBScript
Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set authoringSection = adminManager.GetAdminSection("system.webServer/webdav/authoring", "MACHINE/WEBROOT/APPHOST/Default Web Site")
authoringSection.Properties.Item("enabled").Value = True
authoringSection.Properties.Item("requireSsl").Value = False
adminManager.CommitChanges()
以下示例配置 WebDAV 创作规则,使 WebDAV 客户端可以发布 IIS MIME 映射中未列出的文件,并添加一条向管理员组授予读取、写入和源访问权限的创作规则。
AppCmd.exe
appcmd.exe set config "Default Web Site" -section:system.webServer/webdav/authoringRules /allowNonMimeMapFiles:"True" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.webServer/webdav/authoringRules /+"[roles='administrators',path='*',access='Read, Write, Source']" /commit:apphost
使用 AppCmd.exe 配置这些设置时,必须确保将 commit 参数设置为 apphost。 这会将配置设置提交到 ApplicationHost.config 文件中的相应位置部分。
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
private static void Main()
using (ServerManager serverManager = new ServerManager())
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection authoringRulesSection = config.GetSection("system.webServer/webdav/authoringRules", "Default Web Site");
authoringRulesSection["allowNonMimeMapFiles"] = true;
ConfigurationElementCollection authoringRulesCollection = authoringRulesSection.GetCollection();
ConfigurationElement addElement = authoringRulesCollection.CreateElement("add");
addElement["roles"] = @"administrators";
addElement["path"] = @"*";
addElement["access"] = @"Read, Write, Source";
authoringRulesCollection.Add(addElement);
serverManager.CommitChanges();
VB.NET
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetApplicationHostConfiguration
Dim authoringRulesSection As ConfigurationSection = config.GetSection("system.webServer/webdav/authoringRules", "Default Web Site")
authoringRulesSection("allowNonMimeMapFiles") = True
Dim authoringRulesCollection As ConfigurationElementCollection = authoringRulesSection.GetCollection
Dim addElement As ConfigurationElement = authoringRulesCollection.CreateElement("add")
addElement("roles") = "administrators"
addElement("path") = "*"
addElement("access") = "Read, Write, Source"
authoringRulesCollection.Add(addElement)
serverManager.CommitChanges()
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var authoringRulesSection = adminManager.GetAdminSection("system.webServer/webdav/authoringRules", "MACHINE/WEBROOT/APPHOST/Default Web Site");
authoringRulesSection.Properties.Item("allowNonMimeMapFiles").Value = true;
var authoringRulesCollection = authoringRulesSection.Collection;
var addElement = authoringRulesCollection.CreateNewElement("add");
addElement.Properties.Item("roles").Value = "administrators";
addElement.Properties.Item("path").Value = "*";
addElement.Properties.Item("access").Value = "Read, Write, Source";
authoringRulesCollection.AddElement(addElement);
adminManager.CommitChanges();
VBScript
Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set authoringRulesSection = adminManager.GetAdminSection("system.webServer/webdav/authoringRules", "MACHINE/WEBROOT/APPHOST/Default Web Site")
authoringRulesSection.Properties.Item("allowNonMimeMapFiles").Value = True
Set authoringRulesCollection = authoringRulesSection.Collection
Set addElement = authoringRulesCollection.CreateNewElement("add")
addElement.Properties.Item("roles").Value = "administrators"
addElement.Properties.Item("path").Value = "*"
addElement.Properties.Item("access").Value = "Read, Write, Source"
authoringRulesCollection.AddElement(addElement)
adminManager.CommitChanges()
即将推出:在整个 2024 年,我们将逐步取消以“GitHub 问题”作为内容的反馈机制,并将其替换为新的反馈系统。 有关详细信息,请参阅:https://aka.ms/ContentUserFeedback。
提交和查看相关反馈