質問

分析のログファイルにのって~1%のサービスの通話を終TimeoutExceptionをSilverlightクライアント側で行われます。のサービス、wcf)は非常にシンプルな長い計算.によるログのすべての電話サービスを常に処理される1秒でもTimeoutExceptionが発生したクライアント!), そんなにサーバのタイムアウト.

では何が悪いのでしょうか。できる設定やネットワークの問題なのか。どうですか?どのような追加的なログ情報クリエイティビティのためのローカライズす。

の回避策思考えで再試行サービスの通話後のタイムアウト.

がんの手でこの問題!

更新: 起動時の申請を行う17のサービスの通話および12の同時にこの商品につけられた故障?).

更新: WCFログに含まれていない有用な情報です。その一部のサービスの通話に達しないサーバー側となります。

役に立ちましたか?

解決

問題は、最大同時接続数を単一のサーバーのInternet Explorer7/6.で2! http://msdn.microsoft.com/en-us/library/cc304129(VS.85).aspx

また3(例) 同サービスの通話は一つとして送信サーバーを防ぐ第三のが待っています。また、送信タイマー(対応 sendTimeout は走行資料のご請求時□当社が業務受託にあります。場合は最初の二つのサービス要求するとともに、長時間そして第三の生TimeoutExceptionものかをサーバに送信(まい情報はこの要求をサーバ側できたか、でフィドラーズ...).

によりリアルな状況の場合において12の同時通話、デフォルトは1分の送信タイムアウトがサービスの通話のプロセスをより10秒の平均はやめようということで簡単にタイムアウト例外は呼び出し12 / 2 * 10 sec=60秒)で待つ。

解決には:

  1. 小数の並列サービス。
  2. sendTimeout 価値 お客様 config.
  3. 行の自動再送機能のための重要なサービス
  4. 実施のキューの要求を管理します。

私の場合はもちろん、1-3うことになるでいいのです。

ここでは私の実装のオートリトライ機能:

public static class ClientBaseExtender
{
    /// <summary>
    /// Tries to execute async service call. If <see cref="TimeoutException"/> occured retries again.
    /// </summary>
    /// <typeparam name="TChannel">ServiceClient class.</typeparam>
    /// <typeparam name="TArgs">Type of service client method return argument.</typeparam>
    /// <param name="client">ServiceClient instance.</param>
    /// <param name="tryExecute">Delegate that execute starting of service call.</param>
    /// <param name="onCompletedSubcribe">Delegate that subcribes an event handler to the OnCompleted event of the service client method.</param>
    /// <param name="onCompleted">Delegate that executes when service call is succeeded.</param>
    /// <param name="onError">Delegate that executes when service call fails.</param>
    /// <param name="maxAttempts">Maximum attempts to execute service call before error if <see cref="TimeoutException"/> occured (by default 5).</param>
    public static void ExecuteAsyncRepeatedly<TChannel, TArgs>(this ClientBase<TChannel> client, Action tryExecute,
                                                               Action<EventHandler<TArgs>> onCompletedSubcribe, EventHandler<TArgs> onCompleted,
                                                               EventHandler<TArgs> onError, int maxAttempts)
        where TChannel : class
        where TArgs : AsyncCompletedEventArgs
    {
        int attempts = 0;
        var serviceName = client.GetType().Name;

        onCompletedSubcribe((s, e) =>
                                {
                                    if (e.Error == null) // Everything is OK
                                    {
                                        if (onCompleted != null)
                                            onCompleted(s, e);

                                        ((ICommunicationObject)client).Close();
                                        Debug.WriteLine("[{1}] Service '{0}' closed.", serviceName, DateTime.Now);
                                    }
                                    else if (e.Error is TimeoutException)
                                    {
                                        attempts++;

                                        if (attempts >= maxAttempts) // Final timeout after n attempts
                                        {
                                            Debug.WriteLine("[{2}], Final Timeout occured in '{0}' service after {1} attempts.", serviceName, attempts, DateTime.Now);

                                            if (onError != null)
                                                onError(s, e);
                                            client.Abort();

                                            Debug.WriteLine("[{1}] Service '{0}' aborted.", serviceName, DateTime.Now);
                                            return;
                                        }

                                        // Local timeout
                                        Debug.WriteLine("[{2}] Timeout occured in '{0}' service (attempt #{1}).", serviceName, attempts, DateTime.Now);

                                        Debug.WriteLine("[{2}] Attempt #{0} to execute call to '{1}' service.", attempts + 1, serviceName, DateTime.Now);
                                        tryExecute(); // Try again.
                                    }
                                    else
                                    {
                                        if (onError != null)
                                            onError(s, e);
                                        client.Abort();
                                        Debug.WriteLine("[{1}] Service '{0}' aborted.", serviceName, DateTime.Now);
                                    }
                                });

        Debug.WriteLine("[{2}] Attempt #{0} to execute call to '{1}' service.", attempts + 1, serviceName, DateTime.Now);
        tryExecute(); // First attempt to execute
    }
}

や使用法は以下のとおりです:

var client = new MyServiceClient();
client.ExecuteAsyncRepeatedly(() => client.MyOperationAsync(...),
    (EventHandler<MyOperationCompletedEventArgs> handler) => client.MyOperationCompleted += handler,
    (s, e) => // OnCompleted
        {
            Do(e.Result);
        },
    (s, e) => // OnError
        {
            HandleError(e.Error);
        }
);

ことを期待しすることができます。

他のヒント

あなたはまだこの問題なのか。

そのような場合は、もしかるべき時計、ネットワークとフィドラーズまたはMicrosoftネットワークモニターの前髪みたいにも見えます。

爪...できることを要求/応答を比64Kのやりすぎ直列化されたオブジェ?

きくシミュレーションhitingのサーバコンソール-アプリケーション(チェックの場合はネットワークSL...)?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top