2

3つのWCFサービスを備えたプログラムがあり、それらをローカルで実行すると(つまり、サーバーとクライアントはすべてローカルホスト上にあります)、すべてが機能します。ただし、ネットワークを介してそれらをテストすると、2つのサービスでTimoutExceptionが発生しますが、他のサービスでは発生しません。テストに関係するすべてのマシンでファイアウォールを無効にしました。サーバーにpingを実行することも、クライアントからwsdl「サービスを作成しました」Webページにアクセスすることもできます。

動作するサービスはストリーミングでBasicHttpBindingを使用し、動作しない2つはWSDualHttpBindingを使用します。WSDualHttpBindingを使用するサービスには、両方ともCallbackContractsがあります。この質問があいまいであることをお詫びしますが、どのコードを含めるべきか、またはこれに対する解決策をどこから探し始めるのかさえよくわかりません。

動作しないバインディング:

public static Binding CreateHTTPBinding()
{
  var binding = new WSDualHttpBinding();

  binding.MessageEncoding = WSMessageEncoding.Mtom;

  binding.MaxBufferPoolSize = 2147483647;
  binding.MaxReceivedMessageSize = 2147483647;
  binding.Security.Mode = WSDualHttpSecurityMode.None;
  return binding;
}

例外スタックトレース:

Unhandled Exception: System.TimeoutException: The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.

Server stack trace:
   at System.ServiceModel.Channels.ReliableRequestor.ThrowTimeoutException()
   at System.ServiceModel.Channels.ReliableRequestor.Request(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientReliableDuplexSessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
   at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   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 IDemeService.Register()
   at DemeServiceClient.Register()
   at DemeClient.Client.Start()
   at DemeClient.Program.Main(String[] args)
4

2 に答える 2

0

両側でSystem.Netトレースを有効にして、タイムアウト例外について読むことができます。

http://support.microsoft.com/kb/947285

于 2010-03-27T03:46:16.727 に答える
0

を使用していDualHttpBindingます。これが意味することは、サーバーがメッセージ (応答メッセージではなく着信メッセージ) をクライアントに送信できる二重チャネルを設定していることです。clientBaseAddressしかし、クライアントがサーバーからの着信メッセージをリッスンする場所をセットアップしていません。これがこの問題の原因です。http://msdn.microsoft.com/en-us/library/system.servicemodel.wsdualhttpbinding.aspxから:

このバインディングでは、サービスのコールバック エンドポイントを提供するパブリック URI がクライアントに必要です。これは、ClientBaseAddress によって提供されます。デュアル バインディングは、クライアントの IP アドレスをサービスに公開します。クライアントはセキュリティを使用して、信頼するサービスにのみ接続するようにする必要があります。

于 2013-03-07T18:50:01.447 に答える