我刚刚研究了很多主题,无法找出原因,但我仍然遇到此问题。 我在服务器上的配置。WCF在增加邮件时仍然会收到最大邮件大小错误
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true"/>
</system.web>
<system.serviceModel>
<services>
<service name="MyService.Services.Service">
<endpoint behaviorConfiguration="LargeDataBehavior" address="" binding="wsHttpBinding" contract="MyService.Services.UI.IService" bindingConfiguration="MyBinding">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/MyService.Services/Service/"/>
</baseAddresses>
</host>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding bypassProxyOnLocal="True" name="MyBinding" textEncoding="utf-8"
maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="LargeDataBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
<dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
然后我运行WCF Test Client。
传入消息的最大消息大小配额(65536)已被超出。要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性。
内部异常: 传入消息的最大消息大小配额(65536)已被超出。要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性。
对不起,我的英语不好。 非常感谢您的帮助!
它适合我。 – vutx