【发布时间】:2014-09-13 19:00:29
【问题描述】:
我收到此错误消息
已超出传入邮件的最大邮件大小配额 (65536)
当我尝试将文件 (+-160KB) 上传到我的 WCF 服务时。我试图增加以下属性的值:
maxReceivedMessageSize,
maxBufferPoolSize,
maxArrayLength,
maxStringContentLength,
但我没有运气。我的 WCF 配置文件如下所示:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsBinding" maxReceivedMessageSize="3200000" maxBufferPoolSize="100000000" >
<readerQuotas maxArrayLength="1000000000" maxStringContentLength="3200000" />
</binding>
</wsHttpBinding>
</bindings>
<client />
<services>
<service behaviorConfiguration="PMSService.Thomolosha"
name="PMSService.Thomolosha" >
<endpoint address="" binding="wsHttpBinding" contract="PMSService.ThomoloshaDeclaration">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="PMSService.Arekwe"
name="PMSService.Arekwe">
<endpoint address="" binding="wsHttpBinding" contract="PMSService.ArekweDeclaration">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PMSService.Thomolosha">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<behavior name="PMSService.Arekwe">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
我的 Winform 配置如下所示:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ThomoloshaDeclaration" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="100000000" maxReceivedMessageSize="3200000" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="3200000" maxArrayLength="1000000000"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<binding name="WSHttpBinding_ArekweDeclaration" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="100000000" maxReceivedMessageSize="3200000" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="3200000" maxArrayLength="1000000000"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:57388/Thomolosha.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_ThomoloshaDeclaration" contract="Thomolosha.ThomoloshaDeclaration"
name="WSHttpBinding_ThomoloshaDeclaration">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:57388/Arekwe.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_ArekweDeclaration" contract="Arekwe.ArekweDeclaration"
name="WSHttpBinding_ArekweDeclaration">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
【问题讨论】:
-
在代码中你确定你使用了正确的绑定吗?
-
@GarrettVlieger 如何复制?
-
@Aelphaeis 是的,它适用于小文件。
-
@chosenOneThabs,这与已经回答的问题相同。点击链接查看问题的可能解决方案。
标签: wcf