【发布时间】:2015-04-02 11:26:02
【问题描述】:
当我尝试从控制台应用程序调用 web 服务时,我仍然收到此错误。感谢您的任何想法。
这是我的错误详情 已超出传入邮件的最大邮件大小配额 (65536)。要增加配额,请在适当的绑定元素上使用 MaxReceivedMessageSize 属性。
这是我的 web.config 文件
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="bBinding" receiveTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" allowCookies="true" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647" maxBytesPerRead="2147483647"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="wBinding" maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
<!--https geldiği zaman, mod transport olmalı-->
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="srvBehavior">
<!--https geldiği zaman httpsGetEnabled true olmalı-->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ServiceAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="srvBehavior" name="FordDersService.FordDers">
<endpoint address="soap" binding="basicHttpBinding" bindingConfiguration="bBinding" contract="FordDersService.IFordDers"/>
<endpoint address="rest" binding="webHttpBinding" bindingConfiguration="wBinding" contract="FordDersService.IFordDers" behaviorConfiguration="ServiceAspNetAjaxBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
【问题讨论】:
-
您的客户端配置在绑定配置方面是否相同?
-
是否需要修改客户端配置。我使用添加服务参考添加服务。它会自动将 wcf 服务配置添加到应用配置文件中。
-
@Polat,您应该在客户端配置上添加相同的配置
-
@GiorgiNakeuri 感谢回复。但是我假设在应用配置中自动添加这个配置?
-
它将添加但使用默认设置。在此之后,您必须手动编辑它。
标签: wcf maxreceivedmessagesize