Monday, May 28, 2012

Tfs_DAV folder filling up C: drive

After having spent some time using WEBDAV on one of my Windows 7 computers, I have discovered that my system drive (C:) was filling up quite quickly. After deep investigation I have discovered that any file downloaded or uploaded from/to a network drive mapped with WEBDAV gets copied to a cache on the local system. The location for this local cache is always "c:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp\TfsStore\Tfs_DAV" in Windows 7.

Unfortunately I wasn't able to find the meaning of that 'tfs' acronym in this context, nor I have succeeded in disabling this behavior. What I have understood so far is that:
  • Files from this folder never get deleted (unless you do it manually) 
  • You can't disable it
  • You can't change its location (unless you create a symbolic link)
  • There is no registry key specifying its behavior
  • You can delete this Tfs_DAV folder
  • If you delete Tfs_DAV you will be able to browse WEBDAV drives
  • If you delete Tfs_DAV you will be able to right-click on a field and get its properties
  • If you delete Tfs_DAV you won't be able to open any file, not even text documents
Technically speaking, when you delete that Tfs_DAV folder, the svchost.exe process (started with this commandline: C:\Windows\system32\svchost.exe -k WebClientGroup) will try to get to "C:\Windows\SERVIC~2\LOCALS~1\AppData\Local\Temp\TfsStore\Tfs_DAV" with an IRP_MJ_CREATE operation and gets PATH NOT FOUND as result.

A solution to this problem of the system drive getting filled up with cached copies of network files is to move the Tfs_DAV folder to a different drive.

Here's my batch script to do it:
mkdir Tfs_DAV
cd "c:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp\TfsStore\"
del Tfs_DAV /f /q
mklink Tfs_DAV e:\Tfs_DAV
If the delete command fails, just delete Tfs_DAV from Windows Explorer then rerun this script.

If the procedure succeeds, you will get an output like this:
symbolic link created for Tfs_DAV <<===>> e:\Tfs_DAV 
This is the best I could do for the moment. I will keep investigating the internals of WEBDAV (such as the functioning of the redirectors mrxdav.sys, rdbss.sys and MUP) and will keep this post up-to-date as soon as I find a better workaround than moving Tfs_DAV to another drive.

If you feel like contributing to this post do not hesitate to share your knowledge or experience!

Wednesday, May 23, 2012

maxAllowedContentLength in IIS 7.5

One week ago I have installed a new IIS 7.5 platform and shared a few folders using Webdav. Quickly I discovered that IIS 7.5 is configured to limit uploads and downloads via HTTP to files smaller than 30000000 bytes.

The error I was getting was: 'HTTP Error 404.13 - Not Found : The request filtering module is configured to deny a request that exceeds the request content length'. This is how IIS works by design but it doesn't fit my needs.

To get around this limitation I modified the Web.config file situated under c:\inetpub\webdavroot (it might probably be in different path on your server) and I added the following line:

<requestLimits maxAllowedContentLength="4294967290" />

Setting maxAllowedContentLength to 4294967290 will allow file transfers over http up to 4 gigabytes per file, which should be an acceptable value for a web service.

If your Web.config file does not already have the node, you must add it in the proper place in the section hierarchy. For instance today my Web.config file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<remove users="*" roles="" verbs="" />
<add accessType="Allow" users="web_users" roles="" />
<requestLimits maxAllowedContentLength="4294967290" />
<directoryBrowse enabled="true" />

I hope this post helped you. If so, please do not hesitate to share.

Webclient FileSizeLimitInBytes and error 0x800700DF

Yesterday I have setup a new mapping to a Webdav resource from some of my Windows 7 clients and discovered that I couldn't copy files larger than 50 MB from the IIS Webdav server. The error that was shown when trying to copy was this one: 'Error 0x800700DF: The file size exceeds the limit allowed and cannot be saved '.

This is a due to a built-in parameter which is specified for the Webclient service on Windows 7. By default this service will refuse to copy a large file toward a Webdav destination (such as a IIS/SharePoint web folder) and need therefore to be explicitely configured for larger files upload.

This is done with the help of the FileSizeLimitInBytes registry key under HKLM\SYSTEM\CurrentControlSet\Services\WebClient\Parameters. This registry key specifies the maximum size that the WebClient service allows for file transfers. Its size is in bytes and its default value is 50,000,000 decimal.

For simplicity, my suggestion is to set it up to its maximum value by adding two zeros to the predefined value, then click ok and let the system bring it back to the maximum allowed value for a 32-bit key, which is 4294967295 in decimal or ffffffff in hexadecimal. Faster than typing isn'it?

Unfortunately closing the registry won't solve immediately this problem. So restart the Web Client service using Services.msc or reboot and the problem is forever solved.
Related Posts Plugin for WordPress, Blogger...