简体   繁体   English

使用.runsetting单元测试文件的TFS2015 503服务不可用

[英]TFS2015 503 service unavailable using .runsetting unit test file

In short, using a .runsetting unit test file in a build step on TFS 2015 results in a 503 Service Unavailable exception. 简而言之,在TFS 2015的构建步骤中使用.runsetting单元测试文件会导致503 Service Unavailable异常。

After extensive searching and testing on a new TFS 2015 installation (as also described in TFS2015 new install, 503 Service Unavailable ), I may have found the problem. 在对新的TFS 2015安装进行广泛搜索和测试之后(也如TFS2015的新安装503 Service Unavailable中所述 ),我可能发现了问题。

We are using .runsettings files as described on https://msdn.microsoft.com/en-us/library/jj159530.aspx , in a 'Visual Studio Test' build step on our new TFS2015 installation, as soon as the VSTest.console.exe is called, the next three application pools on the TFS server crash, resulting in a 503 Service Unavailable error: 就像VSTest一样,我们将在https://msdn.microsoft.com/zh-cn/library/jj159530.aspx中描述的.runsettings文件中,在新的TFS2015安装的“ Visual Studio Test”构建步骤中使用。调用console.exe时,TFS服务器上的下三个应用程序池崩溃,从而导致503 Service Unavailable错误:

  1. DefaultAppPool DefaultAppPool
  2. Microsoft Team Foundation Server Application Pool Microsoft Team Foundation Server应用程序池
  3. Microsoft Team Foundation SErver Message Queueu Application Pool Microsoft Team Foundation SErver Message Queueu应用程序池

First my .runsetting file was kind of large, but i did try the next one (I think as small as possible): 首先,我的.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>

When using this one, the app pools crashes. 使用此版本时,应用程序池崩溃。 Even if i remove the part entirely, it will not work. 即使我完全删除了该部分,也无法使用。

As soon as the next line is called (taken from the log lines of the build step), the app pools crashes. 一旦调用下一行(取自构建步骤的日志行),应用程序池就会崩溃。

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

If you look at the DataCollector tag in the .runsettings file, you see the version is set to 14.0.0.0. 如果查看.runsettings文件中的DataCollector标记,则会看到版本设置为14.0.0.0。 If you look at the page of Miscrosoft, they state that it should be 11.0.0.0, but also this version does not work. 如果您查看Miscrosoft的页面,他们指出它应该是11.0.0.0,但是此版本不起作用。 I thought it might be that version 11.0.0.0 was wrong, so I opened the dll with Telerik JustDecompile, and saw that the 'real' version was 14.0.0.0, so I put that version into the runsetting-file. 我以为11.0.0.0版本可能是错误的,所以我用Telerik JustDecompile打开了dll,然后看到“真实”版本是14.0.0.0,因此我将该版本放入了runsetting-file。 But no luck. 但是没有运气。

So for now I'm just remove the runsetting file from the definition of the build, which unfortunately results in a wrong code coverate percentage.. So hopefully someone might have the answer for this. 因此,现在我只是从构建的定义中删除运行设置文件,不幸的是,这将导致错误的代码覆盖率。.因此,希望有人可能对此有答案。

This problem is limited to the specific runsettings file when used with build agent running on the same machine where IIS server is hosting TFS. 与在IIS服务器托管TFS的同一台计算机上运行的生成代理一起使用时,此问题仅限于特定的运行设置文件。 There is a workaround available. 有一种解决方法。 Within DataCollectors->Configuration->CodeCoverage tag in runsettings file you can add following xml tags with given values : 在runsettings文件的DataCollectors-> Configuration-> CodeCoverage标记内,您可以添加以下具有给定值的xml标记:

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

This should solve the issue, and also its recommended that in future if you are using runsettings file with Code coverage in Data Collector then these tags should be added. 这应该可以解决该问题,并且还建议如果将来在Data Collector中使用代码覆盖率的runsettings文件,则应添加这些标签。

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

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