2015-11-18 4 views
5

更新ログ:問題は、ローカルのDevに動作しますが、いないサーバー

  1. が追加されました詳細 - WCFトレース含まれています。

まず、WCFの多くの経験ではないので、明白な誤りである場合はお詫び申し上げます。私は、サードパーティのSOAP Webサービスに接続する必要がある簡単なコンソールアプリケーションを作成しています。サプライヤーから供給されたWSDLはここにある:私は背後に自動生成されたコードを作成する(.NET 4.0を使用)のVisual Studio 2010内サービス参照を作成するために、これを使用している

http://pastebin.com/LJurv0qA

。私はまた、様々な構成のためのapp.configを設定しています今私LocalDevelopmentボックス(つまり、私のラップトップ)上のクライアントが正常に動作し

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
    <section name="CompanyCustomConfig" 
      type="Company.Common.CustomConfigSections.EncryptedSomethingQuiteStrangeCredentialsSection, Company.Common" 
      /> 
    <section name="CompanyMachineConfig" 
      type="Company.Common.CustomConfigSections.MachineEnvironmentKeySection, Company.Common" 
      /> 
    </configSections> 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="sessionMethodsSoap" 
       receiveTimeout="00:10:00" 
       closeTimeout="00:10:00" 
       openTimeout="00:10:00" 
       sendTimeout="00:10:00" 
       maxBufferSize="2147483647" 
       maxBufferPoolSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
      <security mode="Transport" /> 
     </binding> 
     <binding name="sessionMethodsSoap1" /> 
     <binding name="recipientMethodsSoap"> 
      <security mode="Transport"> 
      <!--<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>--> 
      </security> 
     </binding> 
     <!--<binding name="recipientMethodsSoap1" />--> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https:test.jsp" 
      binding="basicHttpBinding" bindingConfiguration="sessionMethodsSoap" 
      contract="Session.sessionMethodsSoap" name="sessionMethodsSoap" /> 
     <endpoint address="https:test.jsp" 
      binding="basicHttpBinding" bindingConfiguration="recipientMethodsSoap" 
      contract="Recipient.recipientMethodsSoap" name="recipientMethodsSoap"  /> 
    </client> 
    </system.serviceModel> 
    <appSettings> 
    <add key="SomethingQuiteStrangeActionsClientBaseUrlWL0280" value="http://localhost.fiddler:13298/api/ua"/> 
    <add key="SomethingQuiteStrangeActionsContentTypeWL0280" value="application/json"/> 
    <add key="SomethingQuiteStrangeActionsClientBaseUrlTesting" value="http://localhost:13298/api/SomethingQuiteStrangeactions"/> 
    <add key="SomethingQuiteStrangeActionsContentTypeTesting" value="application/json"/> 
    <add key="SomethingQuiteStrangeDetailsClientBaseUrlLocalDevelopment" value="http://localhost.fiddler:13298/api/detailsofsomething/> 
    <add key="SomethingQuiteStrangeDetailsContentTypeLocalDevelopment" value="application/json"/> 
    <add key="SomethingQuiteStrangeDetailsClientBaseUrlTesting" value="http://localhost:13298/api/SomethingQuiteStrangedetails"/> 
    <add key="SomethingQuiteStrangeDetailsContentTypeTesting" value="application/json"/> 
    <add key="LogFileDirectoryTesting" value="C"/> 
    <add key="LogFileDirectoryLocalDevelopment" value="C:\LogFiles\CRM"/> 
    </appSettings> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    </startup> 
    <CompanyCustomConfig> 
    <EncryptedSomethingQuiteStrangeCredentials> 
     <EncryptedSomethingQuiteStrangeCredential service="ThingLocalDevelopment" SomethingQuiteStrangeName="un" password="pw"/> 
    </EncryptedSomethingQuiteStrangeCredentials> 
    </CompanyCustomConfig> 
    <CompanyMachineConfig> 
    <MachineEnvironmentKeys> 
     <MachineEnvironmentKey name="DEV" environment="LocalDevelopment" /> 
     <MachineEnvironmentKey name="SERVER" environment="Testing" /> 
    </MachineEnvironmentKeys> 
    </CompanyMachineConfig> 
</configuration> 

は、私は彼らを使用して、thirdpartiesサービスに接続することができますよLogon()アクション。私は、我々のテストサーバー、同じコードとconfiguratioに私のコードを展開し、nは次の例外をスローする場合:

ログファイルが開始:機械TESTSERVER 上18/11/2015 20時11分25秒==== ========================================== ========================== 18/11/2015 20:11 >>>> ***アプリケーションログ:Date Logged:18/11/2015 20 :11:25メッセージ:クライアント(Client.Logon())の問題 - 通信 問題 - メッセージ:HTTP要求を test.jspにするときにエラーが発生しました。これは である可能性があります。これは、HTTPSの場合、サーバー証明書がHTTPSYSを使用して正しく設定されていないためです( )。これは、 のクライアントとサーバー間のセキュリティバインディングの不一致によっても発生する可能性があります。 スタックトレース:

サーバースタックトレース: System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebExceptionで(WebException webException、HttpWebRequestの要求、HttpAbortReason abortReason)
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequestで。 WaitForReplyで System.ServiceModel.Dispatcher.RequestChannelBinder.RequestでSystem.ServiceModel.Channels.RequestChannel.Request(メッセージメッセージ、 のTimeSpanタイムアウト)で(のTimeSpan タイムアウト)(メッセージ メッセージ、のTimeSpanタイムアウト)System.ServiceModel.Channels.ServiceChannel.Call System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCallでで(文字列アクション、 ブール一方向、ProxyOperationRuntime動作は、[]イン、 オブジェクト[]アウト、のTimeSpanタイムアウトオブジェクト) System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessageが メッセージで、ProxyOperationRuntime動作))[0]で

例外再スロー: System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(AT IMessageが reqMsg、IMessageがretMsg)で System.Runtime.Remoting.Proxies.RealProxy。PrivateInvoke Hachette.CRM.AdobeCRMService.AdobeClient.Logonで Hachette.CRM.AdobeCRMService.Session.sessionMethodsSoap.Logon(LogonRequest リクエスト)(で(のMessageData & msgData、のInt32型)) Cで:\アシェットをマイ ドキュメント\ .CRM \ Hachette.CRM.AdobeCRMService \ Adob​​eClient.cs:ライン 84other:以下commenteeの助言にSystem.Collections.ListDictionaryInternal

、私はエラーが発生しているサーバー上のトレースWCFをオンにしています。

enter image description here

我々は、サードパーティのdoesntをHTTPSを使用しているにもかかわらず:メッセージはここチャネルを介して送信され

Exception Type: 
System.Net.WebException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 

Message: 
The underlying connection was closed: An unexpected error occurred on a send. 

Exception Type: 
System.IO.IOException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 

Message: 
Received an unexpected EOF or 0 bytes from the transport stream. 

して明確にするための画像であるた後に例外がスローされます証明書が必要です - Logon()アクションは後で使用するsessionIdを私に提供します - だから私はbasicHttpBindingを使用しますか?知って

もの:

  1. は私の地元の開発ボックスは、Windows 8.1
  2. テストサーバーイムは、Windows Server2008 R2の標準(SP1インストール)を実行しているために展開が実行されています。
  3. My Clientは.NET 4.0 C#コンソールアプリケーションです。
  4. 同じWSDLを使用して、失敗したサーバー上のSOAP UIを試してみました。要求が機能してネットワークから除外されたため、ボックスにWCF/.NETの問題がなければなりません。
  5. また、WCFを使用するアプリケーションでは、サービス参照と自動生成されたコードが追加されているため、WCFの有効化をオンにする必要がありますか?それは他のサイト(サービスモデル3.0.0.0を必要とする)クラッシュさせているため私たちはオフになっています:

enter image description here

+0

実際のエラーはタイムアウトのようです。 '.System.ServiceModel.Channels.RequestChannel.Request(Message message、TimeSpan timeout)の.System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpanタイムアウト)。あなたのローカルenvで動作すると言っているので、これはサーバーとWSホストの間のネットワークの問題だと思います。ファイアウォール設定とファイアウォールログを確認します。彼らはあなたにいくつかの手がかりを与えるかもしれません。 –

+0

@KosalaWファイアウォールのログを取得している私は、私たちが話しているように見て - 私はそれのようなものかもしれないと思った。我々は見るであろう! :P – garfbradaz

+1

WCFトレースを有効にすると、より明確なエラーメッセージが表示されます。 http://www.codeproject.com/Articles/420538/Simple-Steps-to-Enable-Tracing-in-WCFの方法については、次の記事を参照してください。 – StackTrace

答えて

1

最終的な問題は、Windows 2008 Server R2に.NET 4.5.1がインストールされていることです。私は.NET 4.0をターゲットにしていましたが。これで問題は解決し、現在は機能します。

0

は、いくつかのSSLのトラブルシューティングを行います。あなたにさらに手がかりを与えるかもしれない

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; 
  • ​​:一部のオプション:

    1. クイック試みは:解決策が明示的にコールする前にSSLのバージョンを設定することでしたStack Overflow question with the same error message "Received an unexpected EOF or 0 bytes from the transport stream"があります。

    2. Wiresharkなどを使用してください。sniff the SSL handshake

  • 関連する問題