Default team project collection and TeamFoundationServiceUnavailableException: TF31002

In TFS 2010, a default team project collection is configured throught this entry in the tbl_RegistryItems table of tfs_configuration database:

#\Configuration\ DefaultCollection\ 502117a7-f5db-4a60-91ea-2a496678c1bb

 

The value is the collection GUID, and you can get it from SQL server management studio:

1. Right click on the collection db and select properties

2. Select Extended Properties

3. The GUID is the value for "TFS_INSTANCE" field

 

With the default collection TFS registry set, you can make TFS OM API calls using a collection URL that doesn't contain the collection name: e.g. https://TfsServerName:8080. TFS will look up the default collection and use it automatically.

But if this registry entry is missing, then you will get TF31002 exception below. To address this, you can either add the default collection registry entry, or update your TFS OM API calls to use the fully qualified collection url: e.g. https://TfsServerName:8080/CollectionName 

 

Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException: TF31002: Unable to connect to this Team Foundation Server: https://TfsServerName:8080/.

Team Foundation Server Url: https://msTfsServerName:8080/.

Possible reasons for failure include:

- The name, port number, or protocol for the Team Foundation Server is incorrect.

- The Team Foundation Server is offline.

- The password has expired or is incorrect.

Technical information (for administrator):

The request failed with HTTP status 404: Not Found. ---> System.Net.WebException: The request failed with HTTP status 404: Not Found.

at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

at Microsoft.TeamFoundation.Proxy.BisRegistrationServiceProxyWsdl.GetRegistrationEntries(String toolId)

at Microsoft.TeamFoundation.Proxy.BisRegistrationProxy.GetRegistrationEntries(String toolId)

at Microsoft.TeamFoundation.Proxy.BisRegistrationService.RefreshMemoryCache()

at Microsoft.TeamFoundation.Proxy.BisRegistrationService.RefreshCachesIfNeeded(Boolean direct)

at Microsoft.TeamFoundation.Proxy.BisRegistrationService.GetRegistrationEntries(String toolId)

at Microsoft.TeamFoundation.Framework.Client.PreFrameworkServerDataProvider.FindServiceLocation(String serviceType, String toolId)

at Microsoft.TeamFoundation.Framework.Client.PreFrameworkServerDataProvider.LocationForCurrentConnection(String serviceType, Guid serviceIdentifier)

at Microsoft.TeamFoundation.Client.TfsConnection.EnsureProviderConnected()