2013-03-30 82 views
1

wcf無法檢索超過100行的數據集。它顯示消息「已超過傳入消息的最大消息大小限額(65536)。要增加限額,請在適當的綁定元素上使用MaxReceivedMessageSize屬性。」 但裏面的web.config WCF的項目,我做了綁定如下圖所示增加wcf的響應大小

<bindings> 
    <basicHttpBinding> 
    <binding name="basicHttp" allowCookies="true" 
      maxReceivedMessageSize="20000000" 
      maxBufferSize="20000000" 
      maxBufferPoolSize="20000000"> 
     <readerQuotas maxDepth="32" 
      maxArrayLength="200000000" 
      maxStringContentLength="200000000"/> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<client> 
    <endpoint binding="basicHttpBinding" bindingConfiguration="wsHttpBinding_ILabelService" contract="LabelService.ILabelService" name="BasicHttpBinding_ILabelService"/> 
</client> 

<services> 
    <service name="projectname.Service1" behaviorConfiguration="projectname.Service1Behavior"> 
    <!-- Service Endpoints --> 
    <endpoint address="" binding="wsHttpBinding" contract="projectname.IService1"> 
     <!-- 
      Upon deployment, the following identity element should be removed or replaced to reflect the 
      identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
      automatically. 
     --> 
     <identity> 
     <dns value="localhost"/> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
    </service> 
</services> 

<behaviors> 
    <serviceBehaviors> 
    <behavior name="projectname.Service1Behavior"> 
     <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
     <serviceMetadata httpGetEnabled="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="true"/> 

    </behavior> 
    </serviceBehaviors> 
</behaviors> 


請幫助。

+0

您的代碼不可見,因爲您尚未添加它。請編輯您的帖子並添加必要的代碼,您正在談論。 –

+0

您是否在客戶端和服務器上具有相同的配額設置?一個常見的錯誤是,只有在服務器和客戶端的配置中你增加了配額,仍然只能發送65 kB(或相反) – tchrikch

+0

這意味着什麼?目前正在本地運行它,我只在web.config中更改 – Anand

回答

0
<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="BasicHttpBinding_ILabelService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="3145728" maxBufferPoolSize="524288" maxReceivedMessageSize="3145728" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> 
       <readerQuotas maxDepth="32" maxStringContentLength="3145728" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILabelService" contract="LabelService.ILabelService" name="BasicHttpBinding_ILabelService"/> 
    </client> 
</system.serviceModel> 

編輯

必須設定端點綁定名稱。在你的配置中試試這個。 注意:您的必須將contract設置爲具有完整名稱空間結構的服務類名稱,並將bindingConfiguration設置爲您的綁定帳號name

<client> 
    <endpoint binding="basicHttpBinding" bindingConfiguration="basicHttp" contract="YourNamespace.YourServiceClassName" name="BasicHttpBinding_ILabelService"/> 
</client> 
+0

它顯示相同的信息 – Anand

+0

您是否設置了正確的綁定配置? bindingConfiguration =「wsHttpBinding_Username」 – Fanda

+0

雅,是否有任何其他設置要求 – Anand