我在使用网络服务的mvc 4应用程序中收到以下消息:The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element
。
Web服务是一个asmx文件。我尝试了论坛中提到的一些解决方案 (比如执行maxReceivedMessageSize),但我仍然收到相同的错误消息:
我的网络配置:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<directoryBrowse enabled="true"/>
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ServiceSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://haifaws.haifanet.org.il/service.asmx"
binding="basicHttpBinding" bindingConfiguration="ServiceSoap"
contract="ServiceReference1.ServiceSoap" name="ServiceSoap" />
<endpoint address="http://haifaws.haifanet.org.il/service2.asmx"
binding="basicHttpBinding" bindingConfiguration="Service2Soap"
contract="ServiceReference2.Service2Soap" name="Service2Soap" />
</client>
</system.serviceModel>
</configuration>
非常感谢
答案 0 :(得分:3)
想出来......
在应用程序的Web配置中:
在客户端和绑定标记中保持相同的命名
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:60971/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceClient.IService1" name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>