我的設置:在IIS快遞 WCF錯誤 - 最大郵件大小配額傳入消息(65536)已超過
- ASP.NET客戶端控制檯應用程序託管
- 運行Visual Studio.NET 2012在管理模式
我想從WCF服務返回2個List對象。當我僅返回1個List對象時,我的設置WORKS FINE。但是,當我返回2列表對象時,出現錯誤:
傳入消息的最大消息大小配額(65536)已被超出。要增加配額,請在適當的綁定元素上使用MaxReceivedMessageSize屬性。
我知道這個問題已經在這個網站和其他網站上被詢問了很多次。我已經嘗試幾乎所有發佈在互聯網上的配置文件的各種組合,但仍然沒有爲我工作。
客戶端配置:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="1572864"/>
</system.web>
<system.serviceModel>
<client>
<endpoint name="basicHttpBinding"
address="http://localhost:9502/HCDataService"
binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding"
contract="HC.APP.Common.ServiceContract.IHCServiceContract"
behaviorConfiguration="ServiceBehaviour">
</endpoint>
</client>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483646" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
服務器配置:
<configuration>
<system.serviceModel>
<services>
<service name="HC.APP.Server.Service.HCDataService" behaviorConfiguration="ServiceBehaviour">
<host>
<baseAddresses>
<add baseAddress="http://localhost:9502/HCDataService"/>
</baseAddresses>
</host>
<endpoint name="basicHttpBinding"
address="http://localhost:9502/HCDataService"
binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding"
contract="HC.APP.Common.ServiceContract.IHCServiceContract">
</endpoint>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="01:50:00" openTimeout="01:50:00" sendTimeout="01:50:00" receiveTimeout="01:50:00" >
<readerQuotas maxDepth="128" maxStringContentLength="8388608" maxArrayLength="2147483646" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我已經更新了Trickery爲其他成員提供的配置文件。這現在是一個工作解決方案。我所做的更多的更改是兩個配置上的maxArrayLength =「2147483646」。是的,端點的命名可以改進。 – 2013-04-28 19:39:24
夥計們,我知道這是一個重複的問題,並在我的文章中提到了這一點。我不得不發佈這個問題的原因(也可能是爲什麼存在相同問題的很多變體),因爲WCF配置被壓縮,並且很容易錯過一個MINOR DETAIL。我在本網站以及其他網站上發佈了很多帖子,但無法指出問題所在。它需要一些外部干預來解決問題。所以從技術上講,我的帖子可能聽起來有重複,但它在Trickery指出的小改變中有所不同。 – 2013-04-29 10:57:55