Using WorkItemTrackingCacheRoot in your web.config files

I frequently build custom tooling against the TFS API. Sometimes Windows Applications but most of the time I build Web Applications.

When building Web Applications it is no secret that your application runs under the credentials of the application pool.

When accessing work items via TFS API from your web application you can get the error:

Access to the path C:\ProgramData\Microsoft\Team Foundation\Web Access\Cache_v10.0.30319\705997425′ denied

I have seen this error as well in the SharePoint WebParts that Access TFS.

Cause of this error

You get this error because the user under which the application runs, has no rights on the folder mentioned. Duh ! But why?

Every time your application makes connection to TFS a cache is built up to speed up things in a later stage. This cache consists of a lot of files that are generated.

Visual Studio uses this as well, Visual Studio builds up a cache at:

%userprofile%\AppData\Local\Microsoft\Team Foundation\3.0\Cache

A little off-topic but if you have any problems with red crosses in Team Explorer or Team Explorer acting weird, delete all files in this folder!


When you don’t want to think about anything, you just give the application pool user of your custom application or the service account of your SharePoint application [Modify] rights to the folder mentioned (c:\programdata….). Make sure you do this on all front-ends if you have a load balanced network.

Sometimes this is fine, sometimes this is not allowed by the sys admins. Don’t fear….there is another way !

You can set the cache path yourself!

In your web.config of your application you can add a appSettings key called [WorkItemTrackingCacheRoot] that has a value of a path that you can decide (c:\temp\cache?). In this way you can have all custom files (your website/service, logging and cache) together and set up rights for all required users.

This key is also used in the WebAccessClient. In this case the value points to (did you already guess?)

C:\ProgramData\Microsoft\Team Foundation\Web Access\Cache_v10.0.30319


Hope this helps !

2 Responses to “Using WorkItemTrackingCacheRoot in your web.config files”

  1. This may sound as a very stupid question but I am new to this TFS Work Item stuff and I am still learning my way. But if you can tell me whether the value entered in the “WorkItemTrackingCacheRoot” key is rendered as the path on user’s local machine or the web server? I believe it’s the later but I wanted to confirm.

    • Thanks for your question

      The key applies to the web application it belongs to. So the web.config of the web access client runs on the server and thus the path renders on the server. If you create your own app that runs on your local iis or other server, it renders there.

%d bloggers like this: