2015-02-09 67 views
0

嘗試使用我的WCF服務使用Mtom郵件編碼來嘗試&加快了從SQL Server傳輸大型查詢結果的速度。WCF:客戶端和服務綁定可能不匹配?

這裏是我的服務器端WCF配置:

<service name="IsesService.IsesService"> 
    <endpoint address="" binding="basicHttpBinding" contract="IsesService.IIsesService" bindingConfiguration="basicHttp"> 
     <identity> 
     <dns value="localhost" /> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="http://localhost:8080"/> 
     </baseAddresses> 
    </host> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior> 
     <!-- To avoid disclosing metadata information, 
     set the values below to false before deployment --> 
     <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" /> 
     <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
     <!-- 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> 
<bindings> 
    <basicHttpBinding> 
    <binding name="basicHttp" messageEncoding="Mtom" allowCookies="true" 
      maxReceivedMessageSize="2147483647" 
      maxBufferSize="2147483647" 
      maxBufferPoolSize="2147483647" > 
     <readerQuotas maxDepth="32" 
      maxArrayLength="2147483647" 
      maxStringContentLength="2147483647"/> 
    </binding> 
    </basicHttpBinding> 
</bindings> 

而我的客戶端(WPF應用程序)的配置:

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="basicHttp" maxBufferSize="2147483647" 
      maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom" /> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost:8080/" binding="basicHttpBinding" 
      bindingConfiguration="basicHttp" contract="ServiceReference.IIsesService" 
      name="BasicHttpBinding_IIsesService" /> 
    </client> 
</system.serviceModel> 

我得到客戶端和服務綁定可能不匹配。 ...

+0

你可以在客戶端添加messageEncoding =「Mtom」嗎? – 2015-02-09 17:09:48

+0

不是它的綁定屬性... – Hardgraf 2015-02-09 17:11:31

回答

1

綁定basicHttp的配置應該在服務和客戶端上相同。您可以將<basicHttpBinding>(包括readerQuotas)之間的所有內容從您的服務配置中粘貼到您的客戶端配置中進行修復。

+0

偉大的東西工作。不幸的是Motm似乎沒有解決延遲問題,儘管...... – Hardgraf 2015-02-10 22:40:40

相關問題