【问题标题】:WCF and .NET 3.5: receiving large arraysWCF 和 .NET 3.5:接收大型数组
【发布时间】:2011-07-14 07:06:03
【问题描述】:

我很难理解我做错了什么。我有一个接受数组的简单接口。我无法处理超过 150 个项目 - 退回 400 个错误请求。我究竟做错了什么?任何人都可以发现任何东西吗?我浏览了这篇文章,它似乎是答案,但它对我不起作用:WCF maxReceivedMessageSize not being read from config

该服务托管在 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>

【问题讨论】:

    标签: c# .net wcf wcf-binding


    【解决方案1】:

    要解决在服务器和客户端上打开跟踪的问题,然后检查日志文件。错误消息更多地指向未标记为 [Serializable] 的对象。 请参阅http://msdn.microsoft.com/en-us/library/ms732023.aspx 获取指导。

    【讨论】:

    • 显然我的客户端 (WCFStorm) 将 pic WS 绑定,而不是 httpBasic,我没有对其进行任何自定义。在我将 WS bidning 全部移除后,问题就解决了。
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-09
      • 1970-01-01
      • 2012-05-13
      • 2013-03-25
      • 2011-04-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多