2012-12-07 2 views
1

여러 대의 컴퓨터에서 액세스하는 서버에서 .NET WCF 웹 서비스가 실행되고 있습니다. 필자는 연결을 테스트하기 위해 프록시를 작성하고 웹 서비스에 연결하고 메시지를 보내고 연결을 끊는 PowerShell 스크립트를 가지고 있습니다. 프록시를 작성하는 코드는 다음에서 제공됩니다. http://www.ilovesharepoint.com/2008/12/call-wcf-services-with-powershell.htmlMEX 클라이언트 동작이 컴퓨터마다 다릅니다.

스크립트의 반복을 여러 번 실행하는 배치 파일 (500 번)이 있으며 테스트 스크립트를 실행하는 클라이언트 컴퓨터에 따라 다른 동작이 나타납니다. :

  • 컴퓨터 A : 오류없이 스크립트를 성공적으로 실행합니다. 500 회 반복을 수행하는 데 약 15 분이 소요됩니다.
  • 컴퓨터 B : 반복 횟수가 약 3 % ~ 4 % 실패합니다. 모든 500 반복을 수행하려면 1 시간에 이 필요합니다. 실패는 3-5 분마다 발생합니다.

스크립트가 실패는 메시지가 내가 돌아 받고 있어요 :

예외는 "0"인수 (들) "은 getMetaData를"호출 "메타 데이터 가 해결 될 수없는 참조를 포함 : 'https : // SERVER : 8733/WSEngineService /? WSDL'. " 클라이언트 \의 proxyTest.ps1 \ : 32 문자 : 41 + $ metadataSet = $ mexClient.GetMetadata < < < <() + CategoryInfo : NotSpecified (:) [] ParentContainsErrorRecordException + FullyQualifiedErrorId : DotNetMethodException

D에서

예외 스택 추적은 :

System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke (개체 대상에서 오브젝트 [] ARG uments, MethodInforma 기의의 System.Management.Automation.DotNetAdapter.MethodInvokeDotNet에서 methodInformation, 객체 [] originalArguments) (문자열 methodName로, 개체 대상, MethodInformation [] methodInformation, 객체 [] 인수) System.Management.Automation에서. Adapter.BaseMethodInvoke (PSMethod 방법 개체 [] 인수) System.Management.Automation.ParserOps.CallMethod에서 에서 (토큰 토큰 대상 문자열을 methodName로 목적은 [] paramAr 선 부울 callStatic, 개체 valueToSet 개체) System.Management.Automation.MethodCallNode.InvokeMethod ( 대상, Object [] 인수, 개체 값) 에 System.Managemen System.Management.Automation.StatementListNode에서 System.Management.Automation.AssignmentStatementNode.Execute (배열 입력 파이프 outputPipe, ExecutionContext에의 콘테 XT)에서 t.Automation.MethodCallNode.Execute (배열 입력 파이프 outputPipe, 컨텍스트의 ExecutionContext) .ExecuteStatement (ParseTreeNode 문 어레이 입력 파이프 출력 파이프의 ArrayList & resultList, 의 ExecutionContext 컨텍스트)

MEX 클라이언트 등록이이 예외가 발생 된 코드는

PS D:\CLIENT>>> $mexClient 

SoapCredentials   : System.ServiceModel.Description.ClientCredentials 
HttpCredentials   : 
OperationTimeout   : 00:01:00 
MaximumResolvedReferences : 2147483647 
ResolveMetadataReferences : True 

:

# get metadata of a service 
function global:Get-WsdlImporter($wsdlUrl=$(throw "parameter -wsdlUrl is missing"), $httpGet) 
{ 
     if($httpGet -eq $true) 
     { 
       $local:mode = [System.ServiceModel.Description.MetadataExchangeClientMode]::HttpGet 
     } 
     else 
     { 
       $local:mode = [System.ServiceModel.Description.MetadataExchangeClientMode]::MetadataExchange 
     } 

     $mexClient = New-Object System.ServiceModel.Description.MetadataExchangeClient((New-Object System.Uri($wsdlUrl)),$mode) 
     $mexClient.MaximumResolvedReferences = [System.Int32]::MaxValue 
     $metadataSet = $mexClient.GetMetadata() # <-- Fails sometimes on COMPUTER B but never on COMPUTER A. 
     $wsdlImporter = New-Object System.ServiceModel.Description.WsdlImporter($metadataSet) 

     return $wsdlImporter 
} 

내 웹 서비스는 다음과 같이 구성되어 있습니다 :

<behavior name="WsTuBehaviorConfig"> 
     <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" httpsGetBinding="" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
     <serviceThrottling maxConcurrentCalls="40" maxConcurrentSessions="40" maxConcurrentInstances="40" /> 
     <serviceCredentials> 
     <clientCertificate> 
      <authentication certificateValidationMode="PeerTrust" /> 
     </clientCertificate> 
     <userNameAuthentication userNamePasswordValidationMode="Custom" membershipProviderName="Ldap" customUserNamePasswordValidatorType="MyProduct.Framework.Security.AuthenticationProvider.UserNamePasswordLdapUserId,MyProduct.Framework.Security.AuthenticationProvider" /> 
     </serviceCredentials> 
     <serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="LdapOperationProvider" /> 
     <useRequestHeadersForMetadataAddress /> 
    </behavior> 

    <ws2007HttpBinding> 
    <binding name="ws2007HttpTuBindingConfig" maxReceivedMessageSize="2147483647"> 
     <readerQuotas maxDepth="3200" maxStringContentLength="8192" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="Transport"> 
     <transport clientCredentialType="Basic" proxyCredentialType="None" /> 
     <message clientCredentialType="None" negotiateServiceCredential="false" establishSecurityContext="false" /> 
     </security> 
    </binding> 
    </ws2007HttpBinding> 

    <service behaviorConfiguration="WsTuBehaviorConfig" name="MyProduct.BusinessLibrary.Services.WSEngineService"> 
    <endpoint name="WsEngineWs2007HttpEp" address="ws2007HttpEP" binding="ws2007HttpBinding" bindingConfiguration="ws2007HttpTuBindingConfig" behaviorConfiguration="accessDeniedFaultBehaviorConfig" contract="MyProduct.BusinessLibrary.Services.IWSEngineService" /> 
    <endpoint name="mexWSEngineEP" address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="https://SERVER:8733/WSEngineService/" /> 
     </baseAddresses> 
    </host> 
    </service> 

내가 어떤 SSL 경고를 무시하도록 프록시 테스트 스크립트를 말하고 :

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} 

내가 스크립트가 가끔 컴퓨터 B에 실패한 이유에 당황 해요,하지만 컴퓨터에 결코 실패하지 않는다 A. 불행히도 COMPUTER B는 웹 서비스에 대한 성능 테스트를 실행하기위한로드 드라이버이며 오류로 인해 테스트 수행 능력이 저하됩니다. 테스트를 위해 컴퓨터 A를 사용할 수 없기 때문에 여기에 들어가기를 원하지 않습니다. 두 컴퓨터간에 유일한 차이점은 COMPUTER A는 Windows 7 Professional 워크 스테이션이고 COMPUTER B는 Windows 2008 R2 서버입니다. 둘 다 .NET 프레임 워크와 PowerShell을 동일한 버전으로 설치합니다.

컴퓨터 B가 내 웹 서비스의 메타 데이터를 가져 오지 못하는 이유에 대한 아이디어가있는 사람이 있습니까?

답변

1

나는 원인과 치료법을 발견했다고 생각합니다.

COMPUTER B에는 회사 네트워크에 연결된 네트워크 어댑터가 하나씩 있으며, 하나는 비활성화되어 있고 다른 하나는 사용 가능한 4 개의 IP 주소가 있으며 "알 수없는 네트워크"에 연결되어 있습니다. 네트워크에 연결된 어댑터 1 개를 제외한 모든 어댑터를 비활성화했으며 컴퓨터 B는 이제 컴퓨터 A처럼 작동합니다.

관련 문제