我可以轻松检索大量数据,但将其发送回服务会显示此错误.我已经尝试将该元素添加到web.config和servicereferences.clientconfig中,并且在两者中都无法识别.有一次,我得到了一条关于将readerQuotas添加到bindingElementExtensions的消息,但是我找不到有关如何执行此操作的任何有用信息.我发现帖子说我必须修改devenv.exe.config等等,但这样做就是VS.我一直试图解决这两天,所以任何帮助将不胜感激.
编辑:这是web.config的绑定部分:
<bindings> <customBinding> <binding name="QaRiM.Web.Service1.customBinding0"> <binaryMessageEncoding /> <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> </binding> </customBinding> </bindings> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> <services> <service name="QaRiM.Web.Service1"> <endpoint address="" binding="customBinding" bindingConfiguration="QaRiM.Web.Service1.customBinding0" contract="QaRiM.Web.Service1" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services>
和servicereferences.clientconfig:
<configuration> <system.serviceModel> <bindings> <customBinding> <binding name="CustomBinding_Service1"> <binaryMessageEncoding /> <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> </binding> </customBinding> </bindings> <client> <endpoint address="http://localhost:36533/Service1.svc" binding="customBinding" bindingConfiguration="CustomBinding_Service1" contract="ServiceReference1.Service1" name="CustomBinding_Service1" /> </client> </system.serviceModel> </configuration>
两者都是由VS生成的.
您只是缺少
maximum string content length的配置.
<readerQuotas maxStringContentLength="2147483647" />
抱歉,我没有意识到这个子元素位于使用自定义绑定时使用的编码下,在您的示例中它似乎是bebinaryMessageEncoding.如果没有,请尝试使用该设置的其他编码.
<bindings> <customBinding> <binding name="QaRiM.Web.Service1.customBinding0"> <binaryMessageEncoding> <readerQuotas maxStringContentLength="2147483647"/> </binaryMessageEncoding> </binding> </customBinding> </bindings>