2014-08-29 63 views
0

我正在編寫wcf服務以從sql db獲取數據。它正在返回我近2000行14列。我收到錯誤消息:「傳入郵件的最大郵件大小限額(65536)已超出。要增加配額,請在適當的綁定元素上使用MaxReceivedMessageSize屬性。' 我的web.config是 -傳入消息的最大消息大小配額(65536)已被超出 - 在wcf服務中

<system.serviceModel> 
<bindings> 
    <basicHttpBinding> 
    <binding name="BasicHttpBinding_IService1" 
     hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" 
     maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" 
     transferMode="Buffered"> 
     <readerQuotas maxDepth="32" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" /> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<services> 
    <service behaviorConfiguration="serviceBehavior" name="GetSqlData1.Service1"> 
    <endpoint binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" 
     contract="GetSqlData1.IService1" /> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="serviceBehavior"> 
     <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
     <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
     <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<protocolMapping> 
    <add binding="basicHttpsBinding" scheme="https" /> 
</protocolMapping>  
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 

+0

的可能重複的[的最大消息大小配額用於傳入消息(65536)已被超過(http://stackoverflow.com/questions/7232355/the-maximum-message-size-quota-for-傳入消息-65536已被超出) – 2014-08-29 12:59:23

回答

0

嗨請該行添加到您的serviceBehaviors部分: -

<dataContractSerializer maxItemsInObjectGraph="2147483646"/> 

請參見下面的示例。

<serviceBehaviors> 
     <behavior name="serviceBehavior"> 
      <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
      <!-- Please add this line --> 
      <dataContractSerializer maxItemsInObjectGraph="2147483646"/> 
     </behavior> 
</serviceBehaviors> 
+0

仍顯示相同的消息。 – Krishna 2014-09-01 05:46:23

+0

嗨,請求您請分享客戶端配置文件。看起來像你的客戶端設置是問題的原因。 – ajaysinghdav10d 2014-09-01 08:35:34

+0

其實我使用這個wcf服務monikar在使用宏的excel中顯示數據。所以我沒有客戶端配置。我有單個web.config – Krishna 2014-09-15 10:47:14

相關問題