2009-12-14 103 views
1

,我使用WCF服務。我將一個整數列表傳遞給該服務。這個列表可以得到相當大的10k條目。最終,當列表變得很大時,我從服務中收到一個錯誤。客戶端配置消耗我的Silverlight 3應用程序中的WCF

我知道,我可以設置值以允許更多的數據在ServiceReference.ClientConfig文件中傳輸,但我不知道在哪裏設置和要設置哪個屬性。

由於配置是在服務器上完成,我現在可以顯示服務器配置:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

<appSettings> 
    ... 
</appSettings> 

<system.web> 
<compilation debug="true" /> 
    <httpRuntime maxRequestLength="1048576" 
          executionTimeout="200" /> 
</system.web> 
<system.serviceModel> 
<extensions> 
    <behaviorExtensions> 
    <add name="silverlightFaults" type="DiscoDataSource.SilverlightFaultBehavior, DiscoDataSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> 
    </behaviorExtensions> 
</extensions> 
<bindings> 
    <basicHttpBinding> 
      <binding name="MyBinding" closeTimeout="10:00:00" openTimeout="10:00:00" 
     receiveTimeout="10:00:00" sendTimeout="10:00:00" maxBufferSize="6553600" 
     maxBufferPoolSize="6553600" maxReceivedMessageSize="6553600" > 
       <readerQuotas maxArrayLength="2147483647"/> 
      </binding> 
    </basicHttpBinding> 
</bindings> 
<services> 
    <service behaviorConfiguration="DiscoDataSource.Service1Behavior" 
    name="DiscoDataSource.Service1"> 
    <endpoint address="" behaviorConfiguration="DiscoBehavior" binding="basicHttpBinding" 
     bindingConfiguration="MyBinding" name="standardEndPoint" contract="DiscoDataSource.IService1"> 
     <identity> 
     <dns value="localhost" /> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="http://localhost:8731/Design_Time_Addresses/DiscoDataSource/Service1/" /> 
     </baseAddresses> 
    </host> 
    </service> 
</services> 
<behaviors> 
    <endpointBehaviors> 
    <behavior name="DiscoBehavior"> 
     <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
       <silverlightFaults /> 
    </behavior> 
    </endpointBehaviors> 
    <serviceBehaviors> 
    <behavior name="DiscoDataSource.Service1Behavior"> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="True" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
</system.serviceModel> 
</configuration> 

編輯:我曾與列表的大小實驗我送(它是與對象字典總是空) 。在60k個元素(〜0.5 MB)之後,發生錯誤。真正困擾我的是,錯誤是臭名昭着的NotFound-Error - 儘管我改變了錯誤報告行爲(對於服務代碼拋出的異常有效)

我已經添加了bnkdev和marc_s,但不幸的是似乎還有另一個障礙。

任何人都可以幫我嗎?

由於提前, 弗蘭克

回答

1

由於您使用的HTTP它可能是值得看的httpRuntime的maxRequestLength,用於例如

<httpRuntime maxRequestLength="2097151"/> 
+0

我在服務App.config中包含了您的提示(如上更新),但它不能解決問題。 – Aaginor 2009-12-15 10:48:53

0

還有在其確定數組中的元素的最大數量的<ReaderQuotas>的附加參數maxArrayLength - 此默認爲8192。

<bindings> 
    <basicHttpBinding> 
     <binding name="standardBindingPoint" closeTimeout="10:00:00" 
      openTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00" 
      maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
      <readerQuotas maxArrayLength="15000"/> 
      <security mode="None" /> 
     </binding> 
    </basicHttpBinding> 
</bindings> 

增加至比其默認更多,足夠大保存您最大的整數列表。

+0

我在服務App.config中包含了您的提示(如上更新),但它不能解決問題。 – Aaginor 2009-12-15 10:49:28