gpt4 book ai didi

c# - 银光和 WCF : Max message size

转载 作者:太空狗 更新时间:2023-10-30 00:47:34 26 4
gpt4 key购买 nike

当我使用 WCF 从我的 silverlight 应用程序中传递一个对象列表时,一切正常,直到列表变得太大。似乎当我超过 80 个项目时,我得到了错误:远程服务器返回意外响应:(404) 未找到

我假设这是因为列表变得太大了,因为当列表有 70 个项目时一切正常。奇怪的错误消息,对吧?

在配置文件中,我将 maxBufferSize 更改为它可以接受的最大值,但我的列表中的项目仍然不能超过 80 个。

如何在不拆分大物体的情况下传递大物体?


谢谢 Shawn,那么我到底应该在哪里做呢?这是我的 ServiceReferences.ClientConfig

<configuration>
<system.serviceModel>
<client>
<!--"http://sy01911.fw.gsjbw.com/WcfService1/Service1.svc"-->
<endpoint address="http://localhost/WcfService1/Service1.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService11"
contract="SilverlightApplication1.ServiceReference1.IService1"
name="BasicHttpBinding_IService1" />
</client>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" maxBufferSize="655360000"
maxReceivedMessageSize="655360000">
<security mode="None" />
</binding>
<binding name="BasicHttpBinding_IService11" maxBufferSize="655360000"
maxReceivedMessageSize="655360000">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>


这是你提到的服务器配置


<services>
<service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior" >
<!-- Service Endpoints -->
<endpoint address="" binding="basicHttpBinding" contract="WcfService1.IService1" >
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService1.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>

最佳答案

如果您从 WCF 发送大量项目,还要确保 maxItemsInObjectGraph 是一个相对较高的数字

<behaviors>
<serviceBehaviors>
<behavior name="YourBahvior">
<dataContractSerializer maxItemsInObjectGraph="6553600"/>
</behavior>
</serviceBehaviors>
</behaviors>

关于c# - 银光和 WCF : Max message size,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/330034/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com