WebDAV Lock Store Defintions <lockStores>

Overview

The WebDAV module is designed to support multiple lock store providers, which are defined in the webdav/globalSettings/lockStores collection. A series of <add> elements define the settings for each lock provider in the <lockStores> collection.

Note

Currently the only property store provider is webdav_simple_lock, which stores WebDAV locks in memory. Because this provider stores locks in memory, the locks are automatically released when IIS or an application pool are restarted.

Compatibility

Version Notes
IIS 10.0 The <lockStores> element was not modified in IIS 10.0.
IIS 8.5 The <lockStores> element was not modified in IIS 8.5.
IIS 8.0 The <lockStores> element was not modified in IIS 8.0.
IIS 7.5 The <lockStores> element ships as a feature of IIS 7.5.
IIS 7.0 The <lockStores> element was introduced in WebDAV 7.5 as part of a separate download for IIS 7.0.
IIS 6.0 N/A

Note

The <lockStores> element was defined in the WebDAV 7.0 schema, but was ignored because WebDAV locks were not implemented in that version.

Note

The WebDAV 7.0 and WebDAV 7.5 modules shipped out-of-band for IIS 7.0, which required downloading and installing the modules from the following URL:

https://www.iis.net/expand/WebDAV

With Windows 7 and Windows Server 2008 R2, the WebDAV 7.5 module ships as a feature for IIS 7.5, so downloading WebDAV is no longer necessary.

Setup

To support WebDAV publishing for your Web server, you must install the WebDAV module. To do so, use the following steps.

Windows Server 2012 or Windows Server 2012 R2

  1. On the taskbar, click Server Manager.
  2. In Server Manager, click the Manage menu, and then click Add Roles and Features.
  3. In the Add Roles and Features wizard, click Next. Select the installation type and click Next. Select the destination server and click Next.
  4. On the Server Roles page, expand Web Server (IIS), expand Web Server, expand Common HTTP Features, and then select WebDAV Publishing. Click Next.
    Screenshot of the Server Roles page. Web Server I I S is expanded. Web Server is expanded. Common H T T P Features is expanded. Web DAV Publishing is selected and highlighted.
  5. On the Select features page, click Next.
  6. On the Confirm installation selections page, click Install.
  7. On the Results page, click Close.

Windows 8 or Windows 8.1

  1. On the Start screen, move the pointer all the way to the lower left corner, right-click the Start button, and then click Control Panel.
  2. In Control Panel, click Programs and Features, and then click Turn Windows features on or off.
  3. Expand Internet Information Services, expand World Wide Web Services, expand Common HTTP Features, and then select WebDAV Publishing.
    Screenshot of the Windows Features dialog. Web DAV Publishing is highlighted and selected.
  4. Click OK.
  5. Click Close.

Windows Server 2008 R2

  1. On the taskbar, click Start, point to Administrative Tools, and then click Server Manager.
  2. In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS).
  3. In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services.
  4. On the Select Role Services page of the Add Role Services Wizard, expand Common HTTP Features, select WebDAV Publishing, and then click Next.
    Screenshot of the Add Role Services Wizard. The Select Role Services page is shown. Web DAV Publishing is highlighted and selected.
  5. On the Confirm Installation Selections page, click Install.
  6. On the Results page, click Close.

Windows 7

  1. On the taskbar, click Start, and then click Control Panel.
  2. In Control Panel, click Programs and Features, and then click Turn Windows Features on or off.
  3. Expand Internet Information Services, then World Wide Web Services, and then Common HTTP Features.
  4. Select WebDAV Publishing, and then click OK.
    Screenshot of the Windows Features dialog box. The Turn Windows features on or off page is shown. Web DAV Publishing is selected and highlighted.

Windows Server 2008 or Windows Vista

How To

How to configure WebDAV locking for a Web site

  1. Open Internet Information Services (IIS) Manager:

    • If you are using Windows Server 2012 or Windows Server 2012 R2:

      • On the taskbar, click Server Manager, click Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows 8 or Windows 8.1:

      • Hold down the Windows key, press the letter X, and then click Control Panel.
      • Click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
    • If you are using Windows Server 2008 or Windows Server 2008 R2:

      • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows Vista or Windows 7:

      • On the taskbar, click Start, and then click Control Panel.
      • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
  2. In the Connections pane, expand the server name, expand the Sites node, then click the name of the site.

  3. In the site's Home pane, double-click WebDAV Authoring Rules.
    Screenshot of the Server Home page. In the Home pane, the Web DAV Authoring Rules icon is selected.

  4. When the WebDAV Authoring Rules page is displayed, click WebDAV Settings in the Actions pane.

  5. When the WebDAV Settings page is displayed, specify the following options in the Lock Behavior section:

    • Set Allow Locks to True.
    • For Lock Store, choose webdav_simple_lock from the drop-down list.
    • Set Require Lock for Writing to your desired setting.
      Screenshot of the Web DAV Settings page. In the Lock Behavior section, Allow Locks is set to True. Web Dav underscore simple underscore lock is selected for Lock Store.
  6. Once you have completed the steps, click Apply in the Actions pane.

Configuration

The <lockStores> element is only configurable at the global level in the ApplicationHost.config file. Any settings at the site or application level or in Web.config files are ignored.

Attributes

None.

Child Elements

Element Description
add Optional element. Specifies the settings for a lock store provider.

Configuration Sample

The following example lists a sample <globalSettings> element for a WebDAV server. This example defines the built-in simple providers for locks and properties, and enables WebDAV locks for the server.

<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>

Sample Code

Note

The propertyStores and lockStores collections are populated with the built-in property and lock providers when you install WebDAV. These provider collections are not extensible at this time, so the code samples in this section are only for reference.

The following examples configure WebDAV global settings to re-add the built-in property and lock providers that are copied to your system when you install the WebDAV module.

AppCmd.exe

appcmd.exe set config -section:system.webServer/webdav/globalSettings /+"propertyStores.[name='webdav_simple_prop',image='%windir%\system32\inetsrv\webdav_simple_prop.dll']" /commit:apphost

appcmd.exe set config -section:system.webServer/webdav/globalSettings /+"lockStores.[name='webdav_simple_lock',image='%windir%\system32\inetsrv\webdav_simple_lock.dll']" /commit:apphost

Note

You must be sure to set the commit parameter to apphost when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.

C#

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 globalSettingsSection = config.GetSection("system.webServer/webdav/globalSettings");

         ConfigurationElementCollection propertyStoresCollection = globalSettingsSection.GetCollection("propertyStores");

         ConfigurationElement addElement = propertyStoresCollection.CreateElement("add");
         addElement["name"] = @"webdav_simple_prop";
         addElement["image"] = @"%windir%\system32\inetsrv\webdav_simple_prop.dll";
         propertyStoresCollection.Add(addElement);

         ConfigurationElementCollection lockStoresCollection = globalSettingsSection.GetCollection("lockStores");

         ConfigurationElement addElement1 = lockStoresCollection.CreateElement("add");
         addElement1["name"] = @"webdav_simple_lock";
         addElement1["image"] = @"%windir%\system32\inetsrv\webdav_simple_lock.dll";
         lockStoresCollection.Add(addElement1);

         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 globalSettingsSection As ConfigurationSection = config.GetSection("system.webServer/webdav/globalSettings")

      Dim propertyStoresCollection As ConfigurationElementCollection = globalSettingsSection.GetCollection("propertyStores")

      Dim addElement As ConfigurationElement = propertyStoresCollection.CreateElement("add")
      addElement("name") = "webdav_simple_prop"
      addElement("image") = "%windir%\system32\inetsrv\webdav_simple_prop.dll"
      propertyStoresCollection.Add(addElement)

      Dim lockStoresCollection As ConfigurationElementCollection = globalSettingsSection.GetCollection("lockStores")

      Dim addElement1 As ConfigurationElement = lockStoresCollection.CreateElement("add")
      addElement1("name") = "webdav_simple_lock"
      addElement1("image") = "%windir%\system32\inetsrv\webdav_simple_lock.dll"
      lockStoresCollection.Add(addElement1)

      serverManager.CommitChanges()
   End Sub
End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var globalSettingsSection = adminManager.GetAdminSection("system.webServer/webdav/globalSettings", "MACHINE/WEBROOT/APPHOST");

var propertyStoresCollection = globalSettingsSection.ChildElements.Item("propertyStores").Collection;

var addElement = propertyStoresCollection.CreateNewElement("add");
addElement.Properties.Item("name").Value = "webdav_simple_prop";
addElement.Properties.Item("image").Value = "%windir%\\system32\\inetsrv\\webdav_simple_prop.dll";
propertyStoresCollection.AddElement(addElement);

var lockStoresCollection = globalSettingsSection.ChildElements.Item("lockStores").Collection;

var addElement1 = lockStoresCollection.CreateNewElement("add");
addElement1.Properties.Item("name").Value = "webdav_simple_lock";
addElement1.Properties.Item("image").Value = "%windir%\\system32\\inetsrv\\webdav_simple_lock.dll";
lockStoresCollection.AddElement(addElement1);

adminManager.CommitChanges();

VBScript

Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

Set globalSettingsSection = adminManager.GetAdminSection("system.webServer/webdav/globalSettings", "MACHINE/WEBROOT/APPHOST")

Set propertyStoresCollection = globalSettingsSection.ChildElements.Item("propertyStores").Collection

Set addElement = propertyStoresCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "webdav_simple_prop"
addElement.Properties.Item("image").Value = "%windir%\system32\inetsrv\webdav_simple_prop.dll"
propertyStoresCollection.AddElement(addElement)

Set lockStoresCollection = globalSettingsSection.ChildElements.Item("lockStores").Collection

Set addElement1 = lockStoresCollection.CreateNewElement("add")
addElement1.Properties.Item("name").Value = "webdav_simple_lock"
addElement1.Properties.Item("image").Value = "%windir%\system32\inetsrv\webdav_simple_lock.dll"
lockStoresCollection.AddElement(addElement1)

adminManager.CommitChanges()