首页 > 解决方案 > 构建在本地通过但在詹金斯服务器上失败,system.servicemodel.faultexception 无法加载文件或程序集和 system.timeoutexception

问题描述

我的项目中总共编写了 688 个单元测试。当我在本地开发环境中运行这些单元测试时,所有这些都成功通过了,但是当我在 Jenkins Server 上运行这些单元测试时,有 57 个单元测试失败了 688 个。

我是詹金斯的新手,所以我很困惑该怎么办,因为如果这些问题会出现在我的本地环境中,那么我肯定会尝试解决它,但在詹金斯,我没有任何线索,该怎么做。

下面是通过 Jenkins 构建时生成的 2 个完整堆栈跟踪:

1.)

MESSAGE:
System.ServiceModel.FaultException : Could not load file or assembly 'Store.Common, 
Version=21.1.4766.0, Culture=neutral, PublicKeyToken=bc4823754db87e14' or one of its dependencies. 
The system cannot find the file specified.
+++++++++++++++++++
STACK TRACE:

Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& 
rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, 
ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, 
ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Store.ExternalApi.Proxy.IDocumentHandlingService.Search(SearchRequest request)
at Store.ExternalApi.Proxy.IDocumentHandlingService.Search(SearchRequest request) in 
D:\Dev\Server\mainline\ExternalApi\ExternalApiProxy\DocumentHandlingServiceClient.cs:line 416
at Store.ExternalApi.Tests.WebService.DestroyTests.DestroySearchWebMethod() in 
D:\Dev\Server\mainline\ExternalApi\ExternalApiTests\WebService\DestroyTests.cs:line 26

2.)

MESSAGE:
System.TimeoutException : The request channel timed out while waiting for a reply after 
00:00:59.9990195. Increase the timeout value passed to the call to Request or increase the 
SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a 
longer timeout.
  ----> System.TimeoutException : The HTTP request to 
'http://localhost/ExternalApiWebService/DocumentHandlingService.svc' has exceeded the allotted 
timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.
  ----> System.Net.WebException : The operation has timed out
+++++++++++++++++++
STACK TRACE:

Server stack trace:
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, 
ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, 
ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Store.ExternalApi.Proxy.IDocumentHandlingService.
StoreNewVersionedDocument(StoreNewVersionedDocumentRequest request)

at Store.ExternalApi.Proxy.DocumentHandlingServiceClient.
Store.ExternalApi.Proxy.IDocumentHandlingService.
StoreNewVersionedDocument(StoreNewVersionedDocumentRequest request) in 
D:\Dev\Server\mainline\ExternalApi\ExternalApiProxy\DocumentHandlingServiceClient.cs:line 80

下面是我的 ExternalAPI 项目的 web.config 文件:

<basicHttpsBinding>
        <binding name="DocumentHandlingHttpsBinding" openTimeout="00:10:00" sendTimeout="01:10:00" 
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
        </binding>
</basicHttpsBinding>
<basicHttpBinding>
        <binding name="DocumentHandlingHttpBinding" openTimeout="00:10:00" sendTimeout="01:10:00" 
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
        </binding>
        <binding name="TransferServiceHttpBinding" sendTimeout="00:25:00" maxBufferSize="2147483647" 
maxReceivedMessageSize="9223372036854775807" transferMode="Streamed">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
           <security>
              <message clientCredentialType="UserName" />
           </security>
        </binding>
        <binding name="TransferServiceWindowsHttpBinding" sendTimeout="01:10:00" 
maxBufferSize="2147483647" maxReceivedMessageSize="9223372036854775807" transferMode="Streamed">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
           <security>
              <transport clientCredentialType="Windows" />
           </security>
        </binding>
</basicHttpBinding>
<netTcpBinding>
        <binding name="DocumentHandlingTcpBinding" openTimeout="00:10:00" sendTimeout="01:10:00" 
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
        </binding>
        <binding name="StoreTcpBinding" openTimeout="00:10:00" sendTimeout="01:10:00" 
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
           <security mode="Message">
              <transport clientCredentialType="None" protectionLevel="None" />
              <message clientCredentialType="UserName" />
           </security>
        </binding>
        <binding name="StoreWindowsTcpBinding" openTimeout="00:10:00" sendTimeout="01:10:00" 
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
           <security mode="Transport">
              <transport clientCredentialType="Windows" />
           </security>
        </binding>
        <binding name="TransferServiceTcpBinding" sendTimeout="01:10:00" transferMode="Streamed" 
maxBufferSize="2147483647" maxReceivedMessageSize="9223372036854775807">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
           <security mode="None">
              <transport clientCredentialType="None" protectionLevel="None" />
              <message clientCredentialType="UserName" />
           </security>
        </binding>
</netTcpBinding>
<wsHttpBinding>
        <binding name="StoreHttpBinding" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
           <security>
              <message clientCredentialType="UserName" />
           </security>
        </binding>
        <binding name="StoreWindowsHttpBinding" sendTimeout="00:10:00" 
maxReceivedMessageSize="2147483647">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="536870912" 
/>
           <security>
              <message clientCredentialType="Windows" />
           </security>
        </binding>
        <!--HTTPS-->
        <binding name="StoreHttpsBinding" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="104857600" 
/>
           <security mode="TransportWithMessageCredential">
              <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
              <message clientCredentialType="UserName" establishSecurityContext="true" 
algorithmSuite="Default" />
           </security>
        </binding>
        <binding name="StoreWindowsHttpsBinding" sendTimeout="00:10:00" 
maxReceivedMessageSize="2147483647">
           <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="104857600" 
/>
           <security mode="TransportWithMessageCredential">
              <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
              <message clientCredentialType="Windows" algorithmSuite="Default" />
           </security>
        </binding>
</wsHttpBinding>

下面是 ExternalAPITest.config 文件: 我所有的单元测试用例都写在 ExternalAPITest 项目中:

   <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
       <configSections>
          <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
             <section name="Store.ExternalApi.Tests.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
          </sectionGroup>
       </configSections>
       <applicationSettings>
          <Store.ExternalApi.Tests.Properties.Settings>
             <setting name="StoreUserName" serializeAs="String">
                <value>syspassword</value>
             </setting>
             <setting name="StorePassword" serializeAs="String">
                <value>syspassword</value>
             </setting>
          </Store.ExternalApi.Tests.Properties.Settings>
       </applicationSettings>
       <system.serviceModel>
          <behaviors>
             <endpointBehaviors>
                <behavior name="StoreClientEndpointBehaviour">
                   <dataContractSerializer maxItemsInObjectGraph="104857600" />
                   <clientCredentials>
                      <serviceCertificate>
                         <authentication certificateValidationMode="None" />
                      </serviceCertificate>
                   </clientCredentials>
                </behavior>
             </endpointBehaviors>
          </behaviors>
          <bindings>
             <basicHttpBinding>
                <binding name="DocumentHandlingServiceBinding" />
                <binding name="TransferServiceHttpBinding" sendTimeout="00:10:00"
                  maxBufferSize="2147483647" maxReceivedMessageSize="9223372036854775807"
                  transferMode="Streamed">
                   <readerQuotas maxDepth="256" maxStringContentLength="104857600"
                     maxArrayLength="536870912" />
                   <security>
                      <message clientCredentialType="UserName" />
                   </security>
                </binding>
             </basicHttpBinding>
             <wsHttpBinding>
                <binding name="StoreHttpBinding" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647">
                   <readerQuotas maxDepth="256" maxStringContentLength="104857600" maxArrayLength="104857600"/>
                   <security>
                      <message clientCredentialType="UserName"/>
                   </security>
                </binding>
             </wsHttpBinding>
          </bindings>
          <client>
             <!-- new API service -->
             <endpoint address="http://localhost/ExternalApiWebService/DocumentHandlingService.svc"
               binding="basicHttpBinding" bindingConfiguration="DocumentHandlingServiceBinding"
               contract="IDocumentHandlingService" name="DocumentHandlingService" />
    <!-- internal API services so that tests can talk to Store directly -->
         <endpoint address="http://localhost:8000/AuthorizationManager/"
           behaviorConfiguration="StoreClientEndpointBehaviour" binding="wsHttpBinding"
           bindingConfiguration="StoreHttpBinding" contract="Store.IAuthorizationManager"
           name="AuthorizationManagerHttp">
            <identity>
               <certificate encodedValue="cvpnc2MzsCp/KG6qFpMVEC3XXX" />
            </identity>
         </endpoint>
         <endpoint address="http://localhost:8000/ConfigurationManager/"
           behaviorConfiguration="StoreClientEndpointBehaviour" binding="wsHttpBinding"
           bindingConfiguration="StoreHttpBinding" contract="Store.IConfigurationManager2"
           name="ConfigurationManagerHttp">
            <identity>
               <certificate encodedValue="AwAAAAEAAAAUAAAAr4cvpnc2MzsCp/KG6qFpMVEC3XXX
            </identity>
         </endpoint>
         <endpoint address="http://localhost:8000/DataDefinitionManager/"
           behaviorConfiguration="StoreClientEndpointBehaviour" binding="wsHttpBinding"
           bindingConfiguration="StoreHttpBinding" contract="Store.IDataDefinitionManager2"
           name="DataDefinitionManagerHttp">
            <identity>
               <certificate encodedValue="cvpnc2MzsCp/KG6qFpMVEC3XXX
            </identity>
         </endpoint>
         <endpoint address="http://localhost:8000/DataDefinitionManager/"
           behaviorConfiguration="StoreClientEndpointBehaviour" binding="wsHttpBinding"
           bindingConfiguration="StoreHttpBinding" contract="Store.IFieldTypeManager"
           name="FieldTypeManagerHttp">
            <identity>
               <certificate encodedValue="cvpnc2MzsCp/KG6qFpMVEC3XXX
            </identity>
         </endpoint>
         <endpoint address="http://localhost:8000/DataItemManager/"
           behaviorConfiguration="StoreClientEndpointBehaviour" binding="wsHttpBinding"
           bindingConfiguration="StoreHttpBinding" contract="Store.IDataItemManager4"
           name="DataItemManagerHttp">
            <identity>
               <certificate encodedValue="cvpnc2MzsCp/KG6qFpMVEC3XXX
            </identity>
         </endpoint>
         <endpoint address="http://localhost:8000/InternalDocumentHandlingService"
           behaviorConfiguration="StoreClientEndpointBehaviour" binding="wsHttpBinding"
           bindingConfiguration="StoreHttpBinding" contract="Store.ExternalApi.IInternalDocumentHandlingService"
           name="InternalDocumentHandlingServiceHttp">
            <identity>
               <certificate encodedValue="cvpnc2MzsCp/KG6qFpMVEC3XXX
            </identity>
         </endpoint>
         <endpoint address="http://localhost:8000/MembershipManager/"
           behaviorConfiguration="StoreClientEndpointBehaviour" binding="wsHttpBinding"
           bindingConfiguration="StoreHttpBinding" contract="Store.IMembershipManager"
           name="MembershipManagerHttp">
            <identity>
               <certificate encodedValue="cvpnc2MzsCp/KG6qFpMVEC3XXX
            </identity>
         </endpoint>
         <endpoint address="http://localhost:8000/SearchTemplateManager/"
           behaviorConfiguration="StoreClientEndpointBehaviour" binding="wsHttpBinding"
           bindingConfiguration="StoreHttpBinding" contract="Store.ISearchTemplateManager6"
           name="SearchTemplateManagerHttp">
            <identity>
               <certificate encodedValue="cvpnc2MzsCp/KG6qFpMVEC3XXX
            </identity>
         </endpoint>
         <endpoint address="http://localhost:8000/StorageManager/"
           behaviorConfiguration="StoreClientEndpointBehaviour" binding="wsHttpBinding"
           bindingConfiguration="StoreHttpBinding" contract="Store.IStorageManager"
           name="StorageManagerHttp">
            <identity>
               <certificate encodedValue="cvpnc2MzsCp/KG6qFpMVEC3XXX
            </identity>
         </endpoint>
         <endpoint address="http://localhost:8000/TransferService/" behaviorConfiguration="StoreClientEndpointBehaviour"
           binding="basicHttpBinding" bindingConfiguration="TransferServiceHttpBinding"
           contract="HitecLabs.TransferManager.Common.ITransferService"
           name="TransferService">
            <identity>
               <certificate encodedValue="cvpnc2MzsCp/KG6qFpMVEC3XXX
            </identity>
         </endpoint>
      </client>
   </system.serviceModel>
</configuration>

我尝试增加SendTimeOut但没有运气,我已经从谷歌搜索了相关答案,但它对我的情况没有帮助。

任何人都可以建议我吗?

标签: c#winformswcfjenkinsnunit

解决方案


推荐阅读