This scenario is for After Restoring TFS Database 2013

  1. Open Database instance in Sql Server Management Studio and open database TFS_Configuration
  2. Go to tbl_ServiceHost table and look for entry where Name  = “TEAM FOUNDATION”. Copy the HostId
  3. Go to TFS INSTALL FOLDER \Application Tier\Web Services folder
  4. Open the web.config and update the value for applicationId  key with the value copied in step 2
  5. IISReset
  6. net stop tfsjobagent
  7. net start tfsjobagent