Answered team foundation server api web service errors

  • Saturday, May 26, 2012 1:07 AM
     
      Has Code

    Hi,

    I am trying to develop a web service to access tfs information using the tfs api, the problem that I am having is that although the web service runs just fine when i test using the visual studio deployment server, however when I deploy the web services a website in IIS i get the following error. someone please help.

    Server Error in '/' Application.

    Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.Cache' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.           

    Exception Details: System.BadImageFormatException: Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.Cache' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.Cache' could not be loaded.
    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
    

    Stack Trace:
    [BadImageFormatException: Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.Cache' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
       System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
       System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +271
       System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17
       System.Reflection.Assembly.Load(String assemblyString) +35
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122
    
    [ConfigurationErrorsException: Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.Cache' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +12595114
       System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +503
       System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +142
       System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
       System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +203
       System.Web.Compilation.BuildManager.ExecutePreAppStart() +152
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151
    
    [HttpException (0x80004005): Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.Cache' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12709744
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12547393
    

All Replies

  • Saturday, May 26, 2012 8:28 AM
     
     

    I assume your deploying to another machine/server. In that case you need to install team explorer on the server, its the supported way to get the TFS Client object model installed.

  • Monday, May 28, 2012 12:38 PM
     
     
    Hi I am deploying to my local IIS, are there .dlls that need to be registered in my local GAC?
    • Marked As Answer by richmintz Monday, May 28, 2012 5:16 PM
    • Unmarked As Answer by richmintz Monday, May 28, 2012 5:16 PM
    •  
  • Monday, May 28, 2012 5:17 PM
     
     Answered
    I was able to resolve this issue by setting the web site application pool property 'Enable 32 bit applications' to true and setting the platform target in the project build properties to x86
    • Marked As Answer by richmintz Monday, May 28, 2012 5:18 PM
    • Edited by richmintz Monday, May 28, 2012 5:27 PM
    •  
  • Friday, September 28, 2012 1:30 PM
     
     

    I am getting the same error .Only difference is i am getting this error only when I try to run from cloud

    How do I "'Enable 32 bit applications' to true and setting the platform target in the project build properties to x86" while running on azure cloud ?