Wcf流反序列化异常

时间:2012-09-06 09:03:09

标签: .net wcf serialization exception-handling streaming

在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>

Google Chrome,Firefox,Opera在200Mb数据上的一切都很好。问题仅发生在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

0 个答案:

没有答案