3

在 wcf 中使用流模式时,我遇到了一个非常奇怪的问题。这是我的服务器和客户端配置。

服务器配置:

<system.serviceModel>
    <services>
      <service name="eTreasury.ServiceModel.ServiceImplimentation.BackOfficeService" 
               behaviorConfiguration="ServiceBehavior">
        <endpoint name="streamed"
                  address="/streamed"
                  binding="customBinding"
                  bindingConfiguration="BinaryHttpBindingStreamedConfig"
                  contract="eTreasury.ServiceModel.ServiceContracts.IBackOfficeService"
                  behaviorConfiguration="EndpointBehavior"/>
      </service>
    </services>
    <bindings>
      <customBinding>
        <binding name="BinaryHttpBindingStreamedConfig"
                 openTimeout="00:02:00"
                 receiveTimeout="00:02:00"
                 sendTimeout="00:02:00"
                 closeTimeout="00:02:00">
          <binaryMessageEncoding maxReadPoolSize="2147483647"
                                 maxWritePoolSize="2147483647"
                                 maxSessionSize="2147483647">
            <readerQuotas maxArrayLength="2147483647"
                          maxDepth="1024"
                          maxBytesPerRead="2147483647"
                          maxNameTableCharCount="2147483647"
                          maxStringContentLength="2147483647"/>
          </binaryMessageEncoding>
          <httpTransport maxBufferPoolSize="2147483647"
                          maxBufferSize="2147483647"
                          maxReceivedMessageSize="2147483647"
                          transferMode="StreamedResponse"/>
        </binding>
      </customBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="ClientBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
</system.serviceModel>

客户端配置:

<system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="BinaryHttpBindingStreamedConfig" closeTimeout="00:05:00"
          openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00">
          <binaryMessageEncoding />
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"
            transferMode="StreamedResponse" />
        </binding>
      </customBinding>
    </bindings>
<client>
      <endpoint address="http://localhost:2408/BackOfficeService.svc/streamed"
        binding="customBinding" bindingConfiguration="BinaryHttpBindingStreamedConfig" contract="BackOfficeServiceClient.IBackOfficeService"
        name="BackOfficeStreamedService" />
      </client>
   </system.serviceModel>

在 200Mb 数据上,Google Chrome、Firefox、Opera 一切正常。问题仅出现在 Internet Explorer 中。

格式化程序在尝试反序列化消息时抛出异常:尝试反序列化参数http://tempuri.org/:LoadOrdersResult时出错。InnerException 消息是“反序列化 System.Collections.ObjectModel.ObservableCollection 类型的对象时出错”1[[eTreasury.DataModel.BusinessObjects.OrderListItemForBack, eTreasury.SilverlightDataModel, Version=1.0.0.19815, Culture=neutral, PublicKeyToken=null ]]。文件意外结束。以下元素未关闭:CreatedDate、OrderListItemForBack、LoadOrdersResult、LoadOrdersResponse、Body、Envelope.'。有关详细信息,请参阅 InnerException

4

0 回答 0