2012-04-17 64 views
1

私は自分のプロジェクトでWCFを使用して、データベースにアクセスするサーバーとクライアントの画面からデータを転送しています。大量のデータをWCF経由で転送

転送データの量はかなり大きいので、どのデータを転送するのが最適な方法かを知りたいと思います。

現在、私は約3600個のオブジェクト(タイムスタンプと2倍の値)の少量のデータを照会できます。ただし、この数が約86400個のオブジェクトに増加すると、サービス関数呼び出しのエラーが発生します。

マイサービスとクライアントは、以下のように宣言されています

サーバー:

<system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name=""> 
      <serviceMetadata/> 
      <dataContractSerializer maxItemsInObjectGraph="6553600"/> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service name="serviceName"> 
     <endpoint binding="netTcpBinding" contract="interfaceName"> 
      <identity> 
      <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="net.tcp://localhost:5050/msservice"/> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    </system.serviceModel> 

クライアント:

<system.serviceModel> 
    <bindings> 
     <netTcpBinding> 
     <binding name="NetTcpBinding_IService" closeTimeout="00:02:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:02:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxConnections="10" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"> 
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/> 
      <security mode="Transport"> 
      <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/> 
      <message clientCredentialType="Windows"/> 
      </security> 
     </binding> 
     </netTcpBinding> 
    </bindings> 
    <client> 
     <endpoint address="net.tcp://localhost:5050/msservice" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IService" contract="IService" name="NetTcpBinding_IService"> 
     <identity> 
      <dns value="localhost"/> 
     </identity> 
     </endpoint> 
    </client> 
    </system.serviceModel> 
+0

ストリーミングを見ましたか? [Large Data and Streaming](http://msdn.microsoft.com/en-us/library/ms733742.aspx) – Tim

答えて

1

あなたは、.NET 4にはありますか?そうでない場合は、サービス動作の名前を指定してサービスに関連付ける必要があると思います。

編集:それ以外の場合は、65536のデフォルトmaxItemsInObjectGraph値を使用できます。

<system.serviceModel> 
<services> 
    <service name="YOURPROJECT.Web.YOURSERVICE" 
      behaviorConfiguration="YOURPROJECT-Web-YOURSERVICE"> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
     <behavior name="YOURPROJECT-Web-YOURSERVICE"> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      <dataContractSerializer maxItemsInObjectGraph="6553600"/> 
     </behavior> 
    </serviceBehaviors> 
</behaviors> 
+0

maxItemsInObjectGraphプロパティをメモしてください。これは、OPが探しているものです。 – Chris

+0

私はそのエラーの原因となるものよりも高くしました。 6553600> 86400です。デフォルトは65536です。これは大きな値が認識されないようです。たぶん行動のせいかもしれない。 – richk

+0

最大値は2147483647です。 – richk

関連する問題