【发布时间】:2015-11-17 08:11:34
【问题描述】:
我在上述问题上参考了几个stackoverflow线程,但即使应用了提到的解决方案,我仍然得到同样的错误。
我根据this和this调整了设置,所以我客户端中的web.config和WCF服务中的app.config如下所示:
web.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding maxReceivedMessageSize="10485760" name="WSHttpBinding_IMessengerService">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors >
<endpointBehaviors>
<behavior name="WSHttpBinding_IMessengerService">
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost:8005/MessengerService/Service" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMessengerService" contract="MessengerService.IMessengerService">
<identity>
<servicePrincipalName value="Local Network" />
</identity>
</endpoint>
</client>
</system.serviceModel>
App.config:
<system.serviceModel>
<services>
<!-- This section is optional with the new configuration model introduced in .NET Framework 4. -->
<service name="Omnix.Messenger.Service.MessengerService" behaviorConfiguration="MessengerServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8005/MessengerService/Service" />
</baseAddresses>
</host>
<!-- this endpoint is exposed at the base address provided by host: http://localhost:8005/MessengerService/service -->
<endpoint address="" binding="wsHttpBinding" contract="Omnix.Messenger.Service.Contract.IMessengerService" />
<!-- the mex endpoint is exposed at http://localhost:8005/MessengerService/service/mex -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MessengerServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
谁能指出我做错了什么,以及如何解决这个问题?
【问题讨论】:
-
您已经调整了我看到的消息大小,但我没有看到 maxBufferSize="20481000" maxBufferPoolSize="524288" 。在不增加缓冲区的情况下,更改最大消息大小毫无意义
-
当我添加 maxBufefrSize 时,我收到一条错误消息,指出不允许这样做。似乎此属性不适用于 wsHttpBinding 绑定。
-
好的。所以根据这个(social.msdn.microsoft.com/Forums/vstudio/en-US/…)你可以尝试只玩 maxBufferPoolSize
-
是的,我做到了。我还尝试了 Ricado 的指示。问题仍然存在:(
标签: wcf request content-length