【问题标题】:TFS2015 503 service unavailable using .runsetting unit test fileTFS2015 503 使用 .runsetting 单元测试文件时服务不可用
【发布时间】:2016-05-19 22:09:28
【问题描述】:

简而言之,在 TFS 2015 的构建步骤中使用 .runsetting 单元测试文件会导致 503 Service Unavailable 异常。

在对新的 TFS 2015 安装进行大量搜索和测试后(如 TFS2015 new install, 503 Service Unavailable 中所述),我可能已经找到了问题。

我们正在使用https://msdn.microsoft.com/en-us/library/jj159530.aspx 中描述的 .runsettings 文件,在我们新安装的 TFS2015 的“Visual Studio 测试”构建步骤中,一旦调用 VSTest.console.exe,接下来的三个应用程序池就在TFS 服务器崩溃,导致 503 Service Unavailable 错误:

  1. 默认应用程序池
  2. Microsoft Team Foundation Server 应用程序池
  3. Microsoft Team Foundation SErver Message Queueu 应用程序池

首先我的 .runsetting 文件有点大,但我确实尝试了下一个(我认为尽可能小):

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <!-- Configurations for data collectors -->
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <Configuration>
          <CodeCoverage>
             <!-- Match assembly file paths: -->
             <ModulePaths>
                <Include>
                   <ModulePath>.*\.dll$</ModulePath>
                   <ModulePath>.*\.exe$</ModulePath>
                </Include>
              <Exclude>
                <ModulePath>.*CPPUnitTestFramework.*</ModulePath>
                <ModulePath>.*fluentassertions.*</ModulePath>
                <ModulePath>.*\.test\.dll$</ModulePath>
              </Exclude>
            </ModulePaths>
          </CodeCoverage>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

使用这个时,应用程序池崩溃。即使我完全删除了该部分,它也不起作用。

只要调用下一行(取自构建步骤的日志行),应用程序池就会崩溃。

Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "D:\TfsAgents\Agent1\_work\2\s\[...]\Release\Microsoft.QualityTools.Testing.Fakes.dll" "D:\TfsAgents\Agent1\_work\2\s\[...]\Release\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll" "D:\TfsAgents\Agent1\_work\2\s\[...]\Release\MyClassLib.dll"  /Settings:"D:\TfsAgents\Agent1\_work\2\s\[...]\test.runsettings" /EnableCodeCoverage /logger:trx

如果您查看 .runsettings 文件中的 DataCollector 标记,您会看到版本设置为 14.0.0.0。如果你看一下 Miscrosoft 的页面,他们说应该是 11.0.0.0,但这个版本也不起作用。我认为可能是版本 11.0.0.0 错误,所以我用 Telerik JustDecompile 打开了 dll,看到“真实”版本是 14.0.0.0,所以我将该版本放入运行设置文件中。但没有运气。

所以现在我只是从构建的定义中删除运行设置文件,不幸的是,这会导致错误的代码覆盖百分比。所以希望有人可以回答这个问题。

【问题讨论】:

  • 我尝试使用您提供的 runsettings 文件运行测试,但没有发现任何问题。您的 TFS 服务器的版本是多少?只是 TFS2015 没有任何更新?

标签: unit-testing build code-coverage tfs-2015


【解决方案1】:

当与在 IIS 服务器托管 TFS 的同一台计算机上运行的构建代理一起使用时,此问题仅限于特定的运行设置文件。有一个可用的解决方法。在运行设置文件中的 DataCollectors->Configuration->CodeCoverage 标记中,您可以添加以下具有给定值的 xml 标记:

        <UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
        <AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
        <CollectFromChildProcesses>True</CollectFromChildProcesses>
        <CollectAspDotNet>false</CollectAspDotNet>

这应该可以解决问题,并且还建议将来如果您在 Data Collector 中使用具有代码覆盖率的 runsettings 文件,则应添加这些标签。

【讨论】:

    猜你喜欢
    • 2016-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-18
    • 1970-01-01
    • 1970-01-01
    • 2015-01-14
    相关资源
    最近更新 更多