2011-02-24 19 views
1

我正在使用消息安全和Windows憑據類型。由於某種原因,我現在不使用流媒體和Mtom,但可能在將來考慮。到目前爲止,WCF服務文檔指定您可以傳輸最大2GB的數據。我正在考慮是否可以根據WCF規範傳輸20-40 MB的數據,即使現在這種情況很糟糕,這對我來說仍然適用。在WCF中傳輸10-40MB數據

我可以從WCF服務的數據傳輸高達10MB到客戶端,但是當我試圖增加超過10MB更多的東西是從服務器將數據傳輸到客戶端停止它,我不知道是什麼。
我正在將Web服務對象的集合傳輸到客戶端。 當數據沒有從服務器傳輸到客戶端時,我沒有收到任何錯誤消息,這很奇怪。當我在客戶端和服務器綁定屬性中將傳輸大小設置爲10MB以下時,我可以傳輸1650個對象的集合,但是當其大約1900年時,我不會在客戶端獲得任何內容?爲什麼?

爲了使它工作,我將所有require屬性設置爲max,但它仍然不起作用。 下面是我在客戶端:

<ws2007HttpBinding> 
     <binding name="CustomizeWs2007HttpBinding" sendTimeout="00:10:00" closeTimeout="00:10:00" 
      openTimeout="00:10:00" messageEncoding="Text" receiveTimeout="00:10:00" 
      maxBufferPoolSize="0" 
      maxReceivedMessageSize="2147483647" 
      > 
      <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" 
         maxBytesPerRead="4096" /> 
      <security mode="Message"> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true"/> 
      </security> 
     </binding></ws2007HttpBinding> 

下面是我在WCF服務(服務器):

<ws2007HttpBinding> 
     <binding name="KerberosBinding" maxBufferPoolSize="0" maxReceivedMessageSize="2147483647" 
       messageEncoding="Text" sendTimeout="00:10:00" closeTimeout="00:10:00" 
      openTimeout="00:10:00"> 
     <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" 
         maxBytesPerRead="4096" /> 
     <security> 
      <message negotiateServiceCredential="true" establishSecurityContext="true"/> 
     </security> 
     </binding></ws2007HttpBinding> 

我希望有人有一個答案。 非常感謝你提前。

謝謝克里斯,現在的工作和謝謝所有其他人的迴應。 我是這個網站的新成員,所以不知道在哪裏把我的最終解決方案,無論如何它的粘貼如下:。

15728640 = 15MB
10485760 = 10MB,雖然它太大

客戶端配置:

<behaviors> 
    <endpointBehaviors> 
    <behavior name="PServiceBehavior"> 
     <dataContractSerializer maxItemsInObjectGraph="10485760"/> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 

,並從端點引用它:

<endpoint address="http://localhost:53054/pservicehost/pservice.svc" 

綁定= 「ws2007HttpBinding」 bindingConfiguration = 「PServiceWs2007HttpBinding」behaviorConfiguration =「PServiceBehavior」 contract =「PW ebServiceContract.IPService」 NAME = 「PServiceWs2007HttpBindingEndPoint」>

服務配置:

<behaviors> 
    <serviceBehaviors> 
    <behavior name="PServiceHost.PServiceBehavior"> 
    <serviceMetadata httpGetEnabled="true" /> 
    <serviceDebug includeExceptionDetailInFaults="true" /> 
    <dataContractSerializer maxItemsInObjectGraph="10485760"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

,並從服務中引用它:

<services> 
    <service behaviorConfiguration="PServiceHost.PServiceBehavior" name="PWebService.PService"> 
    <endpoint address="" binding="ws2007HttpBinding" bindingConfiguration="KerberosBinding" contract="PWebServiceContract.IPService"> 
    <identity> 
     <dns value="localhost" /> 
    </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    </service> 
    </services> 
+0

我沒有立即看到一個錯誤,但我經常在WCF(巨型PDF文件)傳輸每個消息100 + MB。 – 2011-02-24 22:33:15

+0

聽起來像你使用流媒體,是嗎? – user633176 2011-02-24 23:34:54

回答

2

也許它是與該油門設置:

<dataContractSerializer maxItemsInObjectGraph="..."/> 
+0

你絕對釘了它。 – user633176 2011-02-28 21:27:49

1

我建議你打開服務器上的WCF跟蹤。這是一個非常有用的工具。它在過去幫助了我很多,特別是如果服務器端出現異常,無法在其他地方輕鬆檢測到。

下面是介紹如何開啓它的鏈接:Service Trace Viewer Tool (SvcTraceViewer.exe)