2

一種のばかげたエラーですが、これはサーバーサイドサービス(WCFデュプレックス)でクライアントを呼び出したいときに発生しました。

割り当てられたwcfコールバックタイムアウト00:01:00内にメッセージを転送できませんでした。信頼できるチャネルの転送ウィンドウに、使用可能なスペースがありませんでした。

また何かmysterious happened too。ユーザーとパスワードが間違っている場合にサービスを呼び出したときのログインメソッドで、sender-callbackを見つけ、送信者のGetErrorメソッドを呼び出して、「ユーザーが間違っています」などの論理エラーを表示します。これはうまく機能しますが、ユーザーとパスワードが正しく、アクセス権がある場合、そのエラーが発生します(他のすべてのクライアント側メソッドでも同じです。これらすべてのメソッドで、単純な文字列よりも多くのデータを送信し、geterrorを送信しました)。

編集2:ほとんどのコールバックメソッドで言うように、データコンテキスト(LINQ to SQL)データクラス(リストまたは単一行)のようなデータを送信していました。だから、これは私の問題かもしれません!
(しかし、WCFデュプレックスを使用し、コールバックメソッドでデータ構造体を送信するのはこれが初めてではありません。私はとても驚いています。)

また、そのエラーの後、私はこのエラーを受け取りました、

画面がサービスからのリクエストを処理できませんhttp:// server:15450/service.svc致命的な障害

編集3: サービス構成:

 <system.serviceModel>
    <services>
      <service name="ContactServer.Business.ContactService"
               behaviorConfiguration="ServiceBehavior">
        <endpoint address=""
                  binding="wsDualHttpBinding"
                  contract="ContactServer.Business.IContactService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange"
                  name="MexBinding"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

およびクライアント構成

  <system.serviceModel>
    <bindings>
      <wsDualHttpBinding>
        <binding name="WSDualHttpBinding_ContactService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
          textEncoding="utf-8" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" />
          <security mode="Message">
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
              algorithmSuite="Default" />
          </security>
        </binding>
      </wsDualHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:1408/ContactService.svc"
        binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_ContactService"
        contract="ServiceReference.ContactService" name="WSDualHttpBinding_ContactService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

詳細: .NET3.5とVisualStudio 2010を使用しています。また、クライアント側でタイムアウトが発生した後も、同じエラーが発生しましたwith 00:01:00 Time。なぜこれが起こったのですか?

4

1 に答える 1

2

問題は、WCFサービスからのエンティティの転送に関するものです。

たとえば、次のデータベースモデルがあります。 ここに画像の説明を入力してください

エンティティフレームワーク:

    public Item GetItem(int id)
    {
        var se = new SampleEntities();
        return se.Items.FirstOrDefault(i => i.Id == id);
    }

コードは間違っているようには見えませんが、実際には、関連するすべてのアイテムを含むアイテムが返されます。

        var s = new SampleServiceClient();
        var item = s.GetItem(1);
        Assert.AreEqual(item.RelatedItems.Any(), true); //equal

データベースに多対多の関係がある場合は特に危険です。したがって、遅延読み込みを無効にする必要があります(戻る直前に無効にすることができます)。

var se = new SampleEntities();
se.ContextOptions.LazyLoadingEnabled = false;
return se.Items.FirstOrDefault(i => i.Id == id);

統合言語クエリからSQL

    public Item GetItem(int id)
    {
        var dc = new DataClasses1DataContext();
        return dc.Items.FirstOrDefault(i => i.Id == id);
    }

例外があります:

パラメータ:GetItemResultをシリアル化しようとしたときにエラーが発生しました。InnerExceptionメッセージは「タイプ「WebApplication1.RelatedItem」のオブジェクトグラフにサイクルが含まれており、参照追跡が無効になっている場合はシリアル化できません。」でした。

DataContextダイアグラムを開き、[プロパティ]->[シリアル化モード]->[無指向性]を設定する必要があります。これがより完全な説明です。

于 2011-02-02T14:41:42.940 に答える