WCF和.net 3.5:接收大数组

本文关键字:数组 net WCF | 更新日期: 2023-09-27 18:02:07

我正在努力理解我做错了什么。我有一个接受数组的简单接口。我不能处理超过150个项目——得到400个错误请求。我做错了什么?有人能发现什么吗?我看了看这篇文章,它似乎是答案,但它不适合我:WCF maxReceivedMessageSize没有从配置中读取。

服务托管在IIS7中,使用。net 3.5。这是我的web.config:

    <system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="MyService.basicHttpBinding" maxReceivedMessageSize="5000000" maxBufferSize="5000000">
                <readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" />
            </binding>          
        </basicHttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="MyService.Service1Behavior">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="true"/>
                <!-- Please set this to false when deploying -->
                <serviceDebug includeExceptionDetailInFaults="True" httpHelpPageEnabled="True"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="MyService.Service1Behavior" name="MyService">
            <endpoint address="ws" binding="wsHttpBinding" contract="IMyService">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <endpoint binding="basicHttpBinding" bindingConfiguration="MyService.basicHttpBinding" contract="IMyService" />
        </service>
    </services>
</system.serviceModel>

WCF和.net 3.5:接收大数组

要排除故障,请在服务器和客户机上同时打开跟踪,然后检查日志文件。错误消息更多地指向未被标记为[Serializable]的对象。参考http://msdn.microsoft.com/en-us/library/ms732023.aspx

接收端配置是什么?我发现序列化器在接收大量数据时崩溃了。