我剛剛研究了很多主題,無法找出原因,但我仍然遇到此問題。 我在服務器上的配置。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