WebDAV can cause error 500 in TFS

image If you enable the IIS WebDAV feature on your Team Foundation Server web site, problems will arise. A typical symptom is the “500: error” message above when trying to delete a Git repository.

TL; DR : The WebDAV Publishing Service should not be enabled on a TFS web site. If you have enabled this feature, disable it or operations in TFS that rely on HTTP verbs controlled by WebDAV (such as DELETE) will not work.

Context

One of our clients was experiencing problems when trying to delete Git repositories in his TFS 2013. Unable to identify the cause, we asked the customer to open a support call with Microsoft to investigate the reason.

During the analysis of the IIS logs, the support engineer realized that requests that used HTTP verbs beyond the typical GET and POST (such as PUT and DELETE, common in REST APIs) failed consistently. At that time, he mentioned that there were other cases of customers with that problem and that the culprit was the IIS’s WebDAV service. Bingo! As soon as we turned off WebDAV, everything started working again.

Bug in WebDAV?

Why did that happen? Is there a problem with WebDAV, then? No, it’s not bug. Only an incompatibility with TFS.

Now to understand what happened, first of all we must know what WebDAV is. According to Wikipedia (emphasis mine):

Web Distributed Authoring and Versioning (WebDAV) is an extension of the Hypertext Transfer Protocol (HTTP) that allows clients to perform remote Web content authoring operations. A working group of the Internet Engineering Task Force (IETF) defined WebDAV in RFC 4918.

The WebDAV protocol makes the Web a readable and writable medium. It provides a framework for users to create, change and move documents on a server; typically a web server or web share.

In other words, and in a huge simplification: WebDAV is a file transfer and management protocol – similar to FTP – but which works on top of HTTP . That is, WebDAV extends HTTP with operations that turn a Web server into a file server without requiring FTP for that. Among other benefits is “firewall-friendliness”, since communication takes place over HTTP.

This extension to the HTTP protocol is implemented through the handling of standard HTTP verbs and the inclusion of new ones such as PROPFIND, MOVE and COPY. This means, for example, that the DELETE verb (used by the TFS REST API to delete a Git repository) has a special meaning in WebDAV: it is used to delete a file.

With WebDAV enabled on the same IIS web site hosting TFS, it intercepts the DELETE call and tries to interpret it as a command to delete a file. As the request does not follow the WebDAV standard (after all, it is a call to a TFS API) the server returns an error message.

Turning off WebDAV

The only alternative in this case is to avoid using WebDAV on the TFS website. Thus, to turn off WebDAV:

  1. Open IIS Manager on the TFS server (application tier);
  2. Select the TFS web site (“Team Foundation Server”);
  3. Locate the WebDAV Authoring Rules icon and double-click it;
    WebDAV Authoring Rules icon
  4. Click the  Disable WebDAV link.
    Disable WebDAV link

Cheers
Igor

Author: Igor Abade

Igor Abade V. Leite ([email protected]) is a Visual Studio ALM MVP (Microsoft Most Valuable Professional) since 2006. Speaker at various Software Development community events (TechEd Brasil, The Developers’ Conference, DevOps Summit Brasil, Agile Brazil, Visual Studio Summit, QCON among others), has also written articles in magazines and websites such as MSDN Brazil. Since March/2011 is one of the owners of Lambda3, a Brazilian consulting company specialized in ALM, software development and training. Visit his blog about VS ALM at http://www.tshooter.com.br/ and follow him on Twitter @igorabade.

Leave your comment!