asp.Net   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了asp.net – 无法加载文件或程序集“Microsoft.TeamFoundation.WorkItemTracking.Client.Cache”或其依赖项之一大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在与一个与TFS进行交互的Web应用程序。当我将应用程序上传到Windows Azure云时,我收到此错误消息

感谢您的投入,以解决这个问题。

粘贴在下面是我收到的错误信息

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.

@R_489_9016@e 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,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecuritychecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,Boolean suppressSecuritychecks) +567
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Boolean forIntrospection) +192
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirectivE) +123

[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) +11568240
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +485
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +79
   System.Web.Compilation.buildManager.GetReferencedAssemblies(CompilationSection compConfig) +337
   System.Web.Compilation.buildManager.CallPreStarTinitMethods() +280
   System.Web.HosTing.HosTingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HosTingEnvironmentParameters hosTingParameters,PolicyLevel policyLevel,Exception appDomainCreationException) +1167

[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) +11700976
   System.Web.httpRuntime.EnsureFirstrequesTinit(httpContext context) +141
   System.Web.httpRuntime.ProcessrequestNotificationPrivate(IIS7Workerrequest wr,httpContext context) +4869205




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

解决方法

是因为您的项目正在尝试在64位环境(azurE)中使用32位dll

要解决这种类型的问题,请使用以下给定的命令创建一个启动脚本

将启动脚本复制到文本文件,并另存为“setup.cmd”。
然后将此文件包含到您的Web角色项目中,设置“copy local”= true
然后在webrole标签中的给定启动命令下面打开您的serviceDefinition.csdef

<webrole > --your webrole
    <Startup>
              <Task commandLine="setup.cmd" executionContext="elevated" />
          </Startup>
</webrole >

启动脚本粘贴如下:

%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/applicationPools /applicationPoolDefaults.enable32BitAppOnWin64:"True" /commit:apphost

大佬总结

以上是大佬教程为你收集整理的asp.net – 无法加载文件或程序集“Microsoft.TeamFoundation.WorkItemTracking.Client.Cache”或其依赖项之一全部内容,希望文章能够帮你解决asp.net – 无法加载文件或程序集“Microsoft.TeamFoundation.WorkItemTracking.Client.Cache”或其依赖项之一所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。