简体   繁体   English

在IIS中运行并连接到Visual Studio Online时,TFS API无法在ASP.NET MVC应用程序中运行

[英]TFS API not working in ASP.NET MVC application when running in IIS and connecting to Visual Studio Online

I'm building an ASP.NET MVC application which connects to TFS. 我正在构建一个连接到TFS的ASP.NET MVC应用程序。 The application is showing the tree with test plans, suites and testcases. 该应用程序显示了包含测试计划,套件和测试用例的树。

When the application is running in Visual Studio 2012 Update 3 everything works OK when connecting to the TFS instance installed on my development machine or when connecting to Visual Studio Online. 当应用程序在Visual Studio 2012 Update 3中运行时,在连接到我的开发计算机上安装的TFS实例或连接到Visual Studio Online时,一切正常。 When I deploy the ASP MVC application on my local IIS it still works when connecting to my local TFS. 当我在本地IIS上部署ASP MVC应用程序时,它仍然可以在连接到我的本地TFS时工作。 However when connecting to Visual Studio Online the TFS API is giving me the error 'Error HRESULT E_FAIL has been returned from a call to a COM component.' 但是,当连接到Visual Studio Online时,TFS API会给出错误“错误HRESULT E_FAIL已从调用COM组件返回。” when I am fetching the entries under a test plan, when accessing ITestPlan.RootSuite.Entries. 当我在测试计划下获取条目时,访问ITestPlan.RootSuite.Entries时。

What could be the problem or a solution? 可能是什么问题或解决方案?

Some more info: 更多信息:

I am referencing the following assemblies, all version 11.0.0.0 我正在引用以下程序集,所有版本都是11.0.0.0

  • Microsoft.TeamFoundation.Build.Common.dll Microsoft.TeamFoundation.Build.Common.dll
  • Microsoft.TeamFoundation.Client.dll Microsoft.TeamFoundation.Client.dll
  • Microsoft.TeamFoundation.Common.dll Microsoft.TeamFoundation.Common.dll
  • Microsoft.TeamFoundation.dll Microsoft.TeamFoundation.dll
  • Microsoft.TeamFoundation.TestManagement.Client.dll Microsoft.TeamFoundation.TestManagement.Client.dll
  • Microsoft.TeamFoundation.TestManagement.Common.dll Microsoft.TeamFoundation.TestManagement.Common.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Client.dll Microsoft.TeamFoundation.WorkItemTracking.Client.dll

When running in Visual Studio the ASP MVC application is running in IISExpress and its loading the following assemblies (according to output window): 在Visual Studio中运行时,ASP MVC应用程序在IISExpress中运行,并且它加载以下程序集(根据输出窗口):

GAC_MSIL GAC_MSIL

  • Microsoft.TeamFoundation.Client.dll Microsoft.TeamFoundation.Client.dll
  • Microsoft.TeamFoundation.Common.dll Microsoft.TeamFoundation.Common.dll
  • Microsoft.TeamFoundation.dll Microsoft.TeamFoundation.dll
  • Microsoft.TeamFoundation.TestManagement.Client.dll Microsoft.TeamFoundation.TestManagement.Client.dll
  • Microsoft.TeamFoundation.TestManagement.Common.dll Microsoft.TeamFoundation.TestManagement.Common.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Client.dll Microsoft.TeamFoundation.WorkItemTracking.Client.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Common.dll Microsoft.TeamFoundation.WorkItemTracking.Common.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.dll Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll

GAC_32 GAC_32

  • Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll

When running in IIS, the following assemblies are loaded (according to Process Monitor): 在IIS中运行时,将加载以下程序集(根据Process Monitor):

C:\\WINDOWS\\assembly\\NativeImages_v4.0.30319_32\\ C:\\ Windows \\组件\\ NativeImages_v4.0.30319_32 \\

  • Microsoft.TeamFoundation.Client.ni.dll Microsoft.TeamFoundation.Client.ni.dll
  • Microsoft.TeamFoundation.Common.ni.dll Microsoft.TeamFoundation.Common.ni.dll
  • Microsoft.TeamFoundation.Diff.ni.dll Microsoft.TeamFoundation.Diff.ni.dll
  • Microsoft.TeamFoundation.TestManagement.Client.ni.dll Microsoft.TeamFoundation.TestManagement.Client.ni.dll
  • Microsoft.TeamFoundation.TestManagement.Common.ni.dll Microsoft.TeamFoundation.TestManagement.Common.ni.dll
  • Microsoft.TeamFoundation.VersionControl.Client.ni.dll Microsoft.TeamFoundation.VersionControl.Client.ni.dll
  • Microsoft.TeamFoundation.VersionControl.Common.Integration.ni.dll Microsoft.TeamFoundation.VersionControl.Common.Integration.ni.dll
  • Microsoft.TeamFoundation.VersionControl.Common.ni.dll Microsoft.TeamFoundation.VersionControl.Common.ni.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.ni.dll Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.ni.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Client.ni.dll Microsoft.TeamFoundation.WorkItemTracking.Client.ni.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.ni.dll Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.ni.dll
  • Microsoft.TeamFoundation.WorkItemTracking.Common.ni.dll Microsoft.TeamFoundation.WorkItemTracking.Common.ni.dll

C:\\WINDOWS\\assembly\\GAC_32\\ C:\\ Windows \\组件\\ GAC_32 \\

  • Microsoft.WITDataStore.dll Microsoft.WITDataStore.dll

The difference is that IISExpress loads the MSIL version of the assembly and IIS loads the native image. 区别在于IISExpress加载程序集的MSIL版本,IIS加载本机映像。 And IIS loads VersionControl assemblies and Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll, and Microsoft.TeamFoundation.Diff.ni.dll instead of Microsoft.TeamFoundation.dll. IIS加载VersionControl程序集和Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll,以及Microsoft.TeamFoundation.Diff.ni.dll而不是Microsoft.TeamFoundation.dll。 This seems strange to me and I can not explain this. 这对我来说似乎很奇怪,我无法解释这一点。

When running in IIS talking to the local TFS or TFS Online, the same assemblies are loaded. 在IIS中与本地TFS或TFS Online通信时,将加载相同的程序集。 The only conclusion I can draw from this is that the data coming back from the server is different. 我可以从中得出的唯一结论是从服务器返回的数据是不同的。 But this conclusion conflicts with the fact that in IISExpress the web application can process TFS Online data. 但是这个结论与IISExpress中的Web应用程序可以处理TFS Online数据的事实相冲突。

This was the only post I could find related to a similar problem I had, I thought I would share the solution I found. 这是我能找到的与我遇到的类似问题相关的唯一帖子,我想我会分享我找到的解决方案。 I'm making a web app to generate XML from TFS changesets linked to a specific projects version. 我正在制作一个Web应用程序,用于从链接到特定项目版本的TFS变更集生成XML。 I ran into a problem where the web app I had created would run in IIS Express from visual studio but when set up in IIS it failed when I used something from the "Microsoft.TeamFoundation.WorkItemTracking.Client" namespace. 我遇到了一个问题,我创建的Web应用程序将从Visual Studio运行在IIS Express中,但是当在IIS中设置时,我使用了来自“Microsoft.TeamFoundation.WorkItemTracking.Client”命名空间的东西时失败了。 After a while of struggling without the VS debug tools (I'm fairly new to coding there was probably a proper way to debug) I found I was getting a "TF30063: You are not authorized to access http://(server) " error. 经过一段时间的努力没有VS调试工具(我对编码很新,可能有一个正确的调试方法)我发现我得到了“TF30063:你没有被授权访问http://(服务器) ”错误。

Anyway the solution: In IIS go to your application pool-advanced settings-process model-identity and change it to custom account, setting your username and password to your TFS username and password. 无论如何解决方案:在IIS中转到您的应用程序池 - 高级设置 - 进程模型 - 身份并将其更改为自定义帐户,将您的用户名和密码设置为您的TFS用户名和密码。

I know this is an old post and this may not be the problem the original poster had but I thought I would post it anyway in case it helps someone. 我知道这是一个老帖子,这可能不是原始海报的问题,但我想我会发布它,以防它有助于某人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM